Re: [HACKERS] Much Ado About COUNT(*)

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Wes <wespvp(at)syntegra(dot)com>
Cc: Greg Stark <gsstark(at)mit(dot)edu>, Csaba Nagy <nagy(at)ecircle-ag(dot)com>, Postgres general mailing list <pgsql-general(at)postgresql(dot)org>
Subject: Re: [HACKERS] Much Ado About COUNT(*)
Date: 2005-01-14 00:44:44
Message-ID: 87y8ewx2ir.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers


Wes <wespvp(at)syntegra(dot)com> writes:

> On 1/13/05 9:50 AM, "Greg Stark" <gsstark(at)mit(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Clodoaldo Pinto 2005-01-14 00:58:24 7.4.6 FC2 MUCH slower from 2.6.9-1.11 to 2.6.10-1.8
Previous Message Wes 2005-01-13 23:55:14 Re: [HACKERS] Much Ado About COUNT(*)

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-01-14 00:44:57 Re: Bug? 8.0 does not use partial index
Previous Message Palle Girgensohn 2005-01-14 00:41:46 Re: Bug? 8.0 does not use partial index