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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Mats Lofkvist <mal(at)algonet(dot)se>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: _bt_check_unique checks every row in table when doing update??
Date: 2002-09-12 14:47:15
Message-ID: 7309.1031842035@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Mats Lofkvist <mal(at)algonet(dot)se> writes:
> tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Mats Lofkvist 2002-09-12 15:09:09 Re: _bt_check_unique checks every row in table when doing update??
Previous Message Mats Lofkvist 2002-09-12 14:23:11 Re: _bt_check_unique checks every row in table when doing update??