Re: Bitmap scans vs. the statistics views - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Bitmap scans vs. the statistics views
Date
Msg-id 12334.1114199603@sss.pgh.pa.us
Whole thread Raw
In response to Re: Bitmap scans vs. the statistics views  (Jan Wieck <JanWieck@Yahoo.com>)
Responses Re: Bitmap scans vs. the statistics views  (Jan Wieck <JanWieck@Yahoo.com>)
List pgsql-hackers
Jan Wieck <JanWieck@Yahoo.com> 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
indexqualrechecks (for lossy indexes)* does the tuple pass any additional non-index restriction  conditions that are
beingenforced 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


pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: Postgres: pg_hba.conf, md5, pg_shadow, encrypted passwords
Next
From: Tom Lane
Date:
Subject: Re: Bitmap scans vs. the statistics views