Re: Do we need so many hint bits?
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Merlin Moncure <mmoncure@gmail.com>
Cc: Simon Riggs <simon@2ndquadrant.com>, Alvaro Herrera <alvherre@2ndquadrant.com>, Jeff Davis <pgsql@j-davis.com>, pgsql-hackers@postgresql.org
Date: 2012-11-20T21:58:46Z
Lists: pgsql-hackers
Merlin Moncure <mmoncure@gmail.com> writes: > Hm, I wonder if you could squeeze two bits out. ISTM here are the > interesting cases enumerated: > 0: xmin unknown > 1: xmin invalid > 2: xmin valid, xmax unknown > 3: xmin valid, xmax invalid > 4: xmin valid, xmax valid > Did I miss any? Yes. xmin unknown, xmax unknown is possible and different from all the above, ie a tuple can be deleted by the creating transaction. (But it could still be visible to some of that transaction's snapshots, so you can't equate this state to "xmin invalid".) There's a fairly big problem with any of these ideas, and it's not even on-disk compatibility. It is that we assume that hint bits can be set without exclusive lock on the buffer. If any of the transitions xmin unknown -> xmin committed, xmin unknown -> xmin aborted, xmax unknown -> xmax committed, xmax unknown -> xmax aborted aren't expressed by setting a bit that wasn't set before, we probably lose that property, and thereby a whole lot of concurrency. regards, tom lane