Re: Improve the efficiency of _bt_killitems.

From: feichanghong <feichanghong(at)qq(dot)com>
To: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, hu_yajun(at)qq(dot)com
Subject: Re: Improve the efficiency of _bt_killitems.
Date: 2024-11-01 08:41:50
Message-ID: tencent_988E2A846425C877D40CBD4EDC0F0C934B07@qq.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Nov 1, 2024, at 16:24, Heikki Linnakangas <hlinnaka(at)iki(dot)fi> wrote:
>
> 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.

Maybe I didn't describe it clearly. What I meant to say is that there shouldn't
be multiple index items on the current page pointing to the same heap TID(ctid).
rather than the same index key.

Best Regards,
Fei Changhong

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2024-11-01 08:47:05 Re: define pg_structiszero(addr, s, r)
Previous Message Heikki Linnakangas 2024-11-01 08:24:02 Re: Improve the efficiency of _bt_killitems.