Re: _bt_check_unique checks every row in table when doing update??

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: _bt_check_unique checks every row in table when doing update??
Дата
Msg-id 7309.1031842035@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: _bt_check_unique checks every row in table when doing update??  (Mats Lofkvist <mal@algonet.se>)
Список pgsql-bugs
Mats Lofkvist <mal@algonet.se> writes:
> tgl@sss.pgh.pa.us (Tom Lane) writes:
>>> (In my case, I think the call to _bt_check_unique could be
>>> avoided altogether since the update isn't changing any of
>>> the columns present in the unique key.
>>
>> It's fairly difficult for the index AM to know that; in general we don't
>> have access to the old tuple to check, at the time the index update is
>> running.

> But you really shouldn't need the old tuple to know this since none
> of the columns present in the unique index are 'set' by the update?
> I.e. the 'not changing the unique key part' is not data dependent,
> it is guarantied by the form of the update statement.

(a) that's even further upstream from the index AM, and (b) what about
BEFORE triggers that change the tuple contents?

            regards, tom lane

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

Предыдущее
От: Mats Lofkvist
Дата:
Сообщение: Re: _bt_check_unique checks every row in table when doing update??
Следующее
От: Mats Lofkvist
Дата:
Сообщение: Re: _bt_check_unique checks every row in table when doing update??