In backend/access/heap/heapam.c, there are two functions that I've been
looking at.
The first is heapgettup() and the other is heap_fetch().
I'm guessing that one (heapgettup()) is used for sequential scans and the
other (heap_fetch()) is used to retreive a tuple based on an index entry.
Is that right? (or close to right - I would guess that heap_fetch() might
also be called for other purposes).
Each of these functions calls HeapTupleSatisfies().
My (novice) interpretation of this code is that, if HeapTupleSatisfies()
succeeds (that is, it sets the 'valid' parameter to TRUE), the given tuple
is visible to the current transaction. If HeapTupleSatisfies() fails (sets
'valid' to FALSE), the tuple is *not* visible to the current transaction.
HeapTupleSatisfies() will return FALSE for a tuple that has been deleted but
not yet VACUUMed away, or for a tuple that has been modified (or added) by
another transaction that has not yet committed, or for a tuple that has been
committed by another transaction but it was committed since our current
command started scanning. (There are probably some other rules that I can
glean from the documentation, but if I got any of those wrong, can someone
correct me?)
If HeapTupleSatisfies() returns FALSE, that means that we have read a page
from disk that contains at least one invisible tuple. If I read a page that
contains only invisible tuples, that was a wasted I/O (at least from my
transaction's perspective).
Did I get (most or any of) this right?
TIA - Murphy
_________________________________________________________________
Concerned that messages may bounce because your Hotmail account has exceeded
its 2MB storage limit? Get Hotmail Extra Storage!
http://join.msn.com/?PAGE=features/es