Jan Wieck <[EMAIL PROTECTED]> writes: > tuples fetched is the number of raw, possibly dead tuples fetched from > the heap. Tuples returned is the number of alive tuples ... IIRC.
No, count_heap_fetch only counts tuples that have already passed the snapshot test. It could be that the places where the counts are actually bumped don't line up with your original vision for the stats design. For a regular index scan, it seems to make sense to count (a) number of TIDs returned by the index AM, and (b) number of tuples returned by the IndexScan node. There are several intermediate steps * does the tuple pass the snapshot test * does the tuple pass any indexqual rechecks (for lossy indexes) * does the tuple pass any additional non-index restriction conditions that are being enforced at the scan level but I'm not sure that counting all the intermediate steps is interesting. The places where the counts are actually taken don't quite line up with this ... there are also some other macros like count_heap_scan and count_index_scan that seem a bit randomly placed. The description in table 23-2 makes it sound like those should count once per scan, but they are bumped inside the per-tuple loops ... regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]