From: | Simon Riggs <simon(dot)riggs(at)enterprisedb(dot)com> |
---|---|
To: | Peter Geoghegan <pg(at)bowt(dot)ie> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Using indexUnchanged with nbtree |
Date: | 2021-06-24 12:39:46 |
Message-ID: | CANbhV-HBYZ-_1TTEyW0BJx_iR_EqRyQkFqns-Pgw4PnLUGsU+A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Jun 23, 2021 at 5:42 PM Peter Geoghegan <pg(at)bowt(dot)ie> wrote:
>
> On Wed, Jun 23, 2021 at 9:31 AM Simon Riggs
> <simon(dot)riggs(at)enterprisedb(dot)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.
This case occurs when we are doing non-HOT UPDATEs. That command is
searched, so the scan will already have touched the heap and almost
certainly the index also, setting any LP_DEAD bits already in the most
frequent case.
So the check isn't going to do anything useful in the vast majority of
cases, which is why its OK to remove it.
--
Simon Riggs http://www.EnterpriseDB.com/
From | Date | Subject | |
---|---|---|---|
Next Message | k.jamison@fujitsu.com | 2021-06-24 12:46:47 | RE: Transactions involving multiple postgres foreign servers, take 2 |
Previous Message | Andrew Dunstan | 2021-06-24 12:03:27 | Re: pgbench logging broken by time logic changes |