"Pavan Deolasee" <[EMAIL PROTECTED]> writes: > When CREATE INDEX starts, it acquires ShareLock on the table. > At this point we may have one or more HOT-update chains in the > table. Tuples in this chain may be visible to one or more running > transactions. The fact that we have ShareLock on the table means > that all tuples in the chain except the one at the head either > RECENTLY_DEAD or were UPDATEd by the same transaction > that is now running CREATE INDEX.
This logic seems pretty questionable to me in view of the recent VACUUM FULL bug fixes. We now know that an update chain can contain tuples that appear DEAD but are later than ones that are RECENTLY_DEAD. How are you defining a HOT chain exactly --- will it be just a part of an update chain that consists only of contiguous tuples that appear live or RECENTLY_DEAD to the CREATE INDEX transaction? > In fact, the serializable transactions started before CREATE INDEX > can not anyway see the index so all this is done to handle > read-committed transactions. You are laboring under an illusion that system catalog accesses are MVCC. SnapshotNow does not behave that way: the system can see the new index as soon as it's committed. (It had better, since it has to start updating the index immediately, whether it's safe to scan it or not.) I'm not sure whether that's fundamental to your argument or not, but it's certainly wrong. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org