Re: Select max(foo) and select count(*) optimization - Mailing list pgsql-performance

From Shridhar Daithankar
Subject Re: Select max(foo) and select count(*) optimization
Date
Msg-id 200401061212.21344.shridhar_daithankar@persistent.co.in
Whole thread Raw
In response to Re: Select max(foo) and select count(*) optimization  (Rod Taylor <pg@rbt.ca>)
Responses Re: Select max(foo) and select count(*) optimization
Re: Select max(foo) and select count(*) optimization
List pgsql-performance
On Tuesday 06 January 2004 01:22, Rod Taylor wrote:
> Anyway, with Rules you can force this:
>
> ON INSERT UPDATE counter SET tablecount = tablecount + 1;
>
> ON DELETE UPDATE counter SET tablecount = tablecount - 1;

That would generate lot of dead tuples in counter table. How about

select relpages,reltuples from pg_class where relname=<tablename>;

Assuming the stats are recent enough, it would be much faster and accurate..

 Shridhar


pgsql-performance by date:

Previous
From: Shridhar Daithankar
Date:
Subject: Re: Select max(foo) and select count(*) optimization
Next
From: "D'Arcy J.M. Cain"
Date:
Subject: Re: Select max(foo) and select count(*) optimization