HOT updates & REDIRECT line pointers - Mailing list pgsql-hackers

From Robert Haas
Subject HOT updates & REDIRECT line pointers
Date
Msg-id CA+TgmoZoXkZMt_N4ctUFgS=Puq=bXFKdC6ieWHYCuwuOK8Lieg@mail.gmail.com
Whole thread Raw
Responses Re: HOT updates & REDIRECT line pointers  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
When the root tuple of a HOT chain is dead, but there's still at least
one non-dead member of the chain, we end up with a REDIRECT line
pointer, which points to a USED line pointer, which in turn points to
a live tuple.  This means we're using 2 line pointers for only 1 line
tuple.  Since line pointers are fairly small, that's not a
catastrophe, but I wonder if it might be possible to do better.

Specifically, I'm wondering if we couldn't get away with rearranging
things so that the root line pointer (which has index entries) points
to the actual tuple, and the other line pointer (which can't have any
index entries) gets marked UNUSED.  In other words, we essentially
bequeath the live tuple that is in effect the current root of the
chain to the original line pointer, and then recycle the line pointer
that formerly referenced that tuple.

Now, the question is, is this safe?  Could someone, for example,
release a pin on the page in the middle of walking a HOT chain and
then reacquire the pin to walk the rest of the chain?  If they did,
they might miss a visible tuple altogether.  I think we typically keep
the pin until we're done with the page in such situations, in which
case it might be safe.  But I also think we've typically viewed that
as a performance optimization rather than as something that's
necessary for correctness.

Thoughts?

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: lots of unused variable warnings in assert-free builds
Next
From: Greg Stark
Date:
Subject: Re: Proposal: Create index on foreign table