From: Shridhar Daithankar <shridhar_daithankar@persistent.co.in>
To: Postgresql Performance <pgsql-performance@postgresql.org>
Subject: Re: Select max(foo) and select count(*) optimization
Date: Tue, 6 Jan 2004 12:12:21 +0530
Message-ID: <200401061212.21344.shridhar_daithankar@persistent.co.in> (raw)
In-Reply-To: <1073332325.8958.8.camel@jester>
References: <BC1F1F20.71370%siracusa@mindspring.com>
<1073332325.8958.8.camel@jester>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: shridhar_daithankar@persistent.co.in
Subject: Re: Select max(foo) and select count(*) optimization
In-Reply-To: <200401061212.21344.shridhar_daithankar@persistent.co.in>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox