Re: COUNT(*) and index-only scans

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Greg Stark <stark(at)mit(dot)edu>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: COUNT(*) and index-only scans
Date: 2011-10-12 13:32:58
Message-ID: CA+TgmoYjHB_G5J75bd0y-0Pyd7PU3efD37-na2BEvyVHL0igtg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Oct 12, 2011 at 2:50 AM, Jeff Davis <pgsql(at)j-davis(dot)com> wrote:
> On Tue, 2011-10-11 at 13:22 -0400, Robert Haas wrote:
>> The real issue is that the costing estimates need to be accurate, and
>> that's where the rubber hits the road.  Otherwise, even if we pick the
>> right way to scan the table, we may do silly things up the line when
>> we go to start constructing the join order.  I think we need to beef
>> up ANALYZE to gather statistics on the fraction of the pages that are
>> marked all-visible, or maybe VACUUM should gather that information.
>> The trouble is that if we VACUUM and then ANALYZE, we'll often get
>> back a value very close to 100%, but then the real value may diminish
>> quite a bit before the next auto-analyze fires.  I think if we can
>> figure out what to do about that problem we'll be well on our way...
>
> Can you send stats messages to keep track when you unset a bit in the
> VM? That might allow it to be more up-to-date.

In theory, that seems like it would work, although I'm a little
worried about the overhead.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2011-10-12 13:34:51 Re: [BUGS] *.sql contrib files contain unresolvable MODULE_PATHNAME
Previous Message Robert Haas 2011-10-12 13:29:06 Re: loss of transactions in streaming replication