Re: Improve the efficiency of _bt_killitems. - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: Improve the efficiency of _bt_killitems.
Date
Msg-id 3c957e3b-1faf-4d11-aaef-d7b773c30046@iki.fi
Whole thread Raw
In response to Improve the efficiency of _bt_killitems.  (feichanghong <feichanghong@qq.com>)
Responses Re: Improve the efficiency of _bt_killitems.
List pgsql-hackers
On 01/11/2024 09:19, feichanghong wrote:
> Hi hackers,
> 
> In the _bt_killitems function, the following logic is present: we 
> search to the right for an index item that matches the heap TID and 
> attempt to mark it as dead. If that index item has already been 
> marked as dead by other concurrent processes, we will continue
> searching. However, there should not be any more matching index items
> on the current page.
Why could there not be more matching items on the page?

Are you assuming a unique index? Even then it's not right; you can have 
multiple index entries point to different heap tuples with the same key, 
as long as they're not visible at the same time. For example, if you 
UPDATE or DELETE+INSERT a row.

-- 
Heikki Linnakangas
Neon (https://neon.tech)




pgsql-hackers by date:

Previous
From: jian he
Date:
Subject: Re: Wrong result when enable_partitionwise_join is on if collation of PartitionKey and Column is different.
Next
From: feichanghong
Date:
Subject: Re: Improve the efficiency of _bt_killitems.