Re: When creating index, why pointing to old version of tuple - Mailing list pgsql-hackers

From Tender Wang
Subject Re: When creating index, why pointing to old version of tuple
Date
Msg-id CAHewXNmP75-q7=sfg4Xan=Qf9UVRgQ5U9WZVmHTk67aWCm4+Bw@mail.gmail.com
Whole thread Raw
In response to Re: When creating index, why pointing to old version of tuple  (Chao Li <li.evan.chao@gmail.com>)
Responses Re: When creating index, why pointing to old version of tuple
List pgsql-hackers


Chao Li <li.evan.chao@gmail.com> 于2025年8月1日周五 14:47写道:
> If the index points to the newest version of the tuple, how do old transactions read the old version of the tuple using an index scan for old transactions?

Say there is a long transaction x1, it is on-going.

And transaction x2 started later than x1 started, and x2 created an index. Should x1 be visible to the new index?

My understanding is, the old transaction x1 cannot use the new index to scan for the old version of the tuple. If you read my example, in the index, the key is the new age value (99), while the old age value is 4, thus using the old value will not hit the index entry.

Yeah, in your case, the index is non-visible for x1. Your saying is correct.  But what if the table already has an index? 
--
Thanks,
Tender Wang

pgsql-hackers by date:

Previous
From: Chao Li
Date:
Subject: Trivial patch to fix a typo
Next
From: Chao Li
Date:
Subject: Re: When creating index, why pointing to old version of tuple