Re: why does count take so long?

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Joseph Shraibman <jks(at)selectacast(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: why does count take so long?
Date: 2003-09-08 01:31:08
Message-ID: 20030908013108.GA11066@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, Sep 07, 2003 at 21:06:26 -0400,
Joseph Shraibman <jks(at)selectacast(dot)net> wrote:
> On a 7.3.4 database:
>
> explain analyse select count(*) from elog;
>
>
> Aggregate (cost=223764.05..223764.05 rows=1 width=0) (actual
> time=81372.11..81372.11 rows=1 loops=1)
> -> Seq Scan on elog (cost=0.00..203012.24 rows=8300724 width=0)
> (actual time=3.91..71542.53 rows=8313762 loops=1)
> Total runtime: 81378.42 msec
> (3 rows)
>
>
> It looks like the aggregate took 10 secs all by itself. What's taking
> so long?

It looks like there are 8 million log records that need to be counted.

There have been some discussions over the last few days about tricks to
get better performance if you need to use count on large tables.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-09-08 01:34:05 Re: tsearch CVS and differences to version for 7.3.x
Previous Message Rod Taylor 2003-09-08 01:29:01 Re: Needed function IF(expr, expr, expr)