Re: count() in 9.2

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Steve Horn <steve(at)stevehorn(dot)cc>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: count() in 9.2
Date: 2012-10-17 15:42:48
Message-ID: CA+U5nMJuUHGr8Ogbg5+qiTiQgTEogRpjeqH1FK4-50rN4FOOgQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On 17 October 2012 16:00, Steve Horn <steve(at)stevehorn(dot)cc> wrote:
> One of the reasons that my team could not take advantage of PostgreSQL was
> due to the poor performance of count(*) aggregate function.
>
> I visited the "Slow Counting" page on the wiki
> (http://wiki.postgresql.org/wiki/Slow_Counting) and it states:
> "Note that the following article only applies to versions of PostgreSQL
> prior to 9.2. Index-only scans are now implemented."
>
> So does this mean that count() is no longer slow? If not, how much faster is
> it? And what does it mean when it says "Index-only scans are now
> implemented."?

I think someone's been drinking the cool-aid...

YMMV but its possible in some cases to get 2-3 times previous
performance on larger, relatively static tables. Not much effect on
smaller, regularly updated tables. Given that most people doing
count() run them either with a WHERE clause or on tables that change
enough you need to re-execute the query, you might not see much in
real usage.

--
Simon Riggs http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Steve Horn 2012-10-17 16:22:21 Re: count() in 9.2
Previous Message Steve Horn 2012-10-17 15:00:39 count() in 9.2