Re: Slow count(*) again...
Robert Haas <robertmhaas@gmail.com>
From: Robert Haas <robertmhaas@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Mladen Gogala <mladen.gogala@vmsinfo.com>,
"david@lang.hm" <david@lang.hm>, Craig Ringer <craig@postnewspapers.com.au>, Vitalii Tymchyshyn <tivv00@gmail.com>, "pgsql-performance@postgresql.org" <pgsql-performance@postgresql.org>
Date: 2010-10-13T06:45:16Z
Lists: pgsql-hackers, 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