Re: Bitmap scans vs. the statistics views

From: Jan Wieck <JanWieck(at)Yahoo(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: josh(at)agliodbs(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Bitmap scans vs. the statistics views
Date: 2005-04-22 20:35:38
Message-ID: 4269601A.7000400@Yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 4/22/2005 3:53 PM, Tom Lane wrote:

> Jan Wieck <JanWieck(at)Yahoo(dot)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 indexqual rechecks (for lossy indexes)
> * does the tuple pass any additional non-index restriction
> conditions that are being enforced at the scan level

Now that you say it ... yes. The whole stats stuff was intended
originally to find "DB tuning hints". A large number of tuples returned
by index scan and filtered out by additional non-index restrictions
indicate that there might be another multicolumn index missing.

Jan

--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2005-04-22 20:36:08 Re: Bad n_distinct estimation; hacks suggested?
Previous Message Dave Held 2005-04-22 20:30:38 Re: Woo hoo ... a whole new set of compiler headaches!! :)