Re: Slow count(*) again... - Mailing list pgsql-performance

From Robert Haas
Subject Re: Slow count(*) again...
Date
Msg-id AANLkTimQcMKPVDuHgQC11COJ9_ad6zY1dwXtqMj8LxKq@mail.gmail.com
Whole thread Raw
In response to Re: Slow count(*) again...  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-performance
On Tue, Oct 12, 2010 at 1:07 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Anyway, if anyone is hot to make COUNT(*) faster, that's where to look.
> I don't think any of the previous discussion in this thread is on-point
> at all, except for the parts where people suggested avoiding it.

I kind of hope that index-only scans help with this, too.  If you have
a wide table and a narrow (but not partial) index, and if the
visibility map bits are mostly set, it ought to be cheaper to read the
index than the table - certainly in the case where any disk I/O is
involved, and maybe even if it isn't.

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

pgsql-performance by date:

Previous
From: Robert Haas
Date:
Subject: Re: How does PG know if data is in memory?
Next
From: Neil Whelchel
Date:
Subject: Re: Slow count(*) again...