Heikki Linnakangas <heikki.linnakan...@enterprisedb.com> writes:
> On 16.12.2010 16:50, Alvaro Herrera wrote:
>> All tuples need to have index pointers, even the dead ones.

> To be precise, tuples that are truly dead, ie. not visible to anyone 
> anymore, don't need index pointers. They usually have index pointers 
> anyway, because they were needed to find the tuples before they became 
> dead. But if you abort a vacuum after it has scanned the indexes, you 
> end up with dead heap tuples with no index pointers. Also, there's an 
> optimization in b-tree that removes index pointers to dead tuples, when 
> they are encountered during index scans.

Another way you can get to that state is failure while inserting the
index entries in the first place, eg one of the indexes reports a
uniqueness failure, whereupon we abort the inserting transaction.
Now the heap tuple is present but dead, and some of the table's indexes
may have entries for it while others don't.

The correct invariant is that (a) if an index entry exists, there must
be a heap tuple for it to point at, and (b) a live tuple must have all
the index entries it should have.

                        regards, tom lane

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Reply via email to