Re: count(*) and bad design was: Experiences with extensibility

From: Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: count(*) and bad design was: Experiences with extensibility
Date: 2008-01-09 19:27:41
Message-ID: 20080109202741.213ae41a@webthatworks.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 9 Jan 2008 10:58:29 -0800
"Joshua D. Drake" <jd(at)commandprompt(dot)com> wrote:

> > OK... we are getting near to the point. I understand the trade-off
> > problem in storing into indexes id the row is still there.
> > Is there a way to get the count of the rows that *may be* there,

> If you analyze regularly you can use pg_class. It isn't exact but is
> usually close enough (especially if you are just using it for
> something like pagination).

But what if I've a

select count(*) from table where condition;

where condition involves just indexed columns and I want to trust the
indexes and I'm not concerned of the deleted rows?
Just to get an estimate between reindexing cycles, that would be
perfect for paging.

pg_class does look as returning all the rows.

--
Ivan Sergio Borgonovo
http://www.webthatworks.it

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Zoltan Boszormenyi 2008-01-09 19:29:39 Re: count(*) and bad design was: Experiences with extensibility
Previous Message Scott Marlowe 2008-01-09 19:07:49 Re: count(*) and bad design was: Experiences with extensibility