Re: Using indexUnchanged with nbtree

Поиск
Список
Период
Сортировка
От Peter Geoghegan
Тема Re: Using indexUnchanged with nbtree
Дата
Msg-id CAH2-WznHigE3XVW-cq=O0GLpV=wZZVJimvZgd581pWV9rQuQ1w@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Using indexUnchanged with nbtree  (Simon Riggs <simon.riggs@enterprisedb.com>)
Ответы Re: Using indexUnchanged with nbtree  (Simon Riggs <simon.riggs@enterprisedb.com>)
Список pgsql-hackers
On Wed, Jun 23, 2021 at 9:31 AM Simon Riggs
<simon.riggs@enterprisedb.com> wrote:
> You're right that skipping the check might also skip killing a prior
> row version, but it doesn't prevent later scans from killing them, so
> there is no correctness aspect to that.

Probably not, no. I'll assume for now that there is no correctness issue.

> In the case of a non-HOT UPDATE the backend will see the index entry
> for the old row version and then check it, pointlessly. Since that has
> just been modified, that won't ever be killed, so skipping the check
> makes sense in those cases.

I agree that the check itself is pointless here. But that in itself
doesn't make the call to _bt_check_unique() useless. It might still
manage to set LP_DEAD bits when nothing else will.

I realize that the original reason for setting LP_DEAD bits in
_bt_check_unique() was something like "well, might as well do this
here too". But I believe that LP_DEAD bit setting inside
_bt_check_unique() is nevertheless often more valuable than the better
known kill_prior_tuple mechanism. I have seen clear and convincing
examples of this in the past. Might not really be true anymore.

Another thing is _bt_findinsertloc() and
_bt_delete_or_dedup_one_page(), which themselves use the
checkingunique flag that you're changing the value of. There could
also be unintended side-effects there. OTOH they also use
indexUnchanged too, so even if there is a problem it might be fixable.

-- 
Peter Geoghegan



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Simon Riggs
Дата:
Сообщение: Re: Using indexUnchanged with nbtree
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: Pipeline mode and PQpipelineSync()