Re: count() in 9.2

From: Steve Horn <steve(at)stevehorn(dot)cc>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: count() in 9.2
Date: 2012-10-17 16:22:21
Message-ID: CAFLkBaUqZnd=6iMDcnTMu9Dy=YvnRSA=_iT-2aiD2MH-=h=p=w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Yeah I should have mentioned...adding a where clause is always my use case
when using count().

So to clarify my question: does anyone have any experience with count()
(with a WHERE clause) in Postgres 9.2?
On Oct 17, 2012 11:42 AM, "Simon Riggs" <simon(at)2ndquadrant(dot)com> wrote:

> 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 Simon Riggs 2012-10-17 16:57:28 Re: count() in 9.2
Previous Message Simon Riggs 2012-10-17 15:42:48 Re: count() in 9.2