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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers