Why to index a "Recently DEAD" tuple when creating index

From: Alex <zhihui(dot)fan1213(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Why to index a "Recently DEAD" tuple when creating index
Date: 2019-06-10 06:45:25
Message-ID: CAKU4AWq8ZW+-c5qTOdTLBUAJ_pN9DDs0spfOSPAsYvALk8ad9A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

HEAPTUPLE_RECENTLY_DEAD, /* tuple is dead, but not deletable yet */

It is a tuple which has been deleted AND committed but before the delete
there is a transaction started but not committed. Let call this transaction
as Transaction A.

if we create index on this time, Let's call this index as Index A, it still
index this record. my question is why need this.

The only reason I can think out (maybe also not reasonable enough) is:
If we index like this and the isolate level of transaction A is
serializable, it is possible that the query in transaction A can use Index
A since it contains the snapshot data when the transaction A was began.
this reason may be not reasonable enough is because the transaction A may
be should not see the index A at all.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kuntal Ghosh 2019-06-10 06:50:08 Re: Questions of 'for update'
Previous Message Fabien COELHO 2019-06-10 06:24:28 Re: Bloom Indexes - bit array length and the total number of bits (or hash functions ?? ) !