Re: [HACKERS] Much Ado About COUNT(*) - Mailing list pgsql-general

From Greg Stark
Subject Re: [HACKERS] Much Ado About COUNT(*)
Date
Msg-id 87y8ewx2ir.fsf@stark.xeocode.com
Whole thread Raw
In response to Re: [HACKERS] Much Ado About COUNT(*)  (Wes <wespvp@syntegra.com>)
Responses Re: [HACKERS] Much Ado About COUNT(*)
List pgsql-general
Wes <wespvp@syntegra.com> writes:

> On 1/13/05 9:50 AM, "Greg Stark" <gsstark@mit.edu> wrote:
>
> Of course, in Oracle 'count(*)' is instantaneous.  It doesn't have to count
> the physical records one by one.

That's simply false. Oracle does indeed have to count the records one by one.

It doesn't have to read and ignore the dead records since they're in a
separate place (but on the other hand it sometimes have to go read that
separate place when it sees records that were committed after your
transaction).

It can also do index-only scans, which often helps, but it's still not
instantaneous.

--
greg

pgsql-general by date:

Previous
From: Wes
Date:
Subject: Re: [HACKERS] Much Ado About COUNT(*)
Next
From: Clodoaldo Pinto
Date:
Subject: 7.4.6 FC2 MUCH slower from 2.6.9-1.11 to 2.6.10-1.8