Re: Why count(*) doest use index?

From: Willy-Bas Loos <willybas(at)gmail(dot)com>
To: John R Pierce <pierce(at)hogranch(dot)com>, obamabarak(at)e1(dot)ru, kamauallan(at)gmail(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Why count(*) doest use index?
Date: 2011-03-05 23:25:40
Message-ID: AANLkTik01yAcNWyZtuC6Pg6s9fCyT0SV+R1QCP2=si9=@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Other well known dbms's do have this possibility, because they place deleted
or updated records in a separate table or file (plz correct me if i'm
wrong). But this has other, greater performance disadvantages. The count(*)
problem is a bit of a publicity problem rather than a real performance
problem (i've been told). People are aware of the fact that count(*) is
faster in other dbms's, but "we" don't want superficial things like
optimizing count(*) for publicity ruin other, more important things for us,
performance-wise.

On Sat, Mar 5, 2011 at 11:46 PM, John R Pierce <pierce(at)hogranch(dot)com> wrote:

> On 03/05/11 2:05 PM, Allan Kamau wrote:
>
>> Is it possible in theory to efficiently perform count the primary or
>> unique indices underlying data structures, regardless whether there is
>> a WHERE clause detailing filtration base on values from such index or
>> not?
>>
>
> indexes are not exact, due to possibly constant changes in the current
> number of visible elements in the relation.
>
>
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

--
"Patriotism is the conviction that your country is superior to all others
because you were born in it." -- George Bernard Shaw

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Willy-Bas Loos 2011-03-05 23:42:45 Re: updating all records of a table
Previous Message John R Pierce 2011-03-05 22:46:47 Re: Why count(*) doest use index?