Re: count(*) and bad design was: Experiences with extensibility - Mailing list pgsql-general

From Ivan Sergio Borgonovo
Subject Re: count(*) and bad design was: Experiences with extensibility
Date
Msg-id 20080109202741.213ae41a@webthatworks.it
Whole thread Raw
In response to Re: count(*) and bad design was: Experiences with extensibility  ("Joshua D. Drake" <jd@commandprompt.com>)
List pgsql-general
On Wed, 9 Jan 2008 10:58:29 -0800
"Joshua D. Drake" <jd@commandprompt.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


pgsql-general by date:

Previous
From: "Scott Marlowe"
Date:
Subject: Re: count(*) and bad design was: Experiences with extensibility
Next
From: Zoltan Boszormenyi
Date:
Subject: Re: count(*) and bad design was: Experiences with extensibility