From: Richard Huxton <dev@archonet.com>
To: Bruce Momjian <pgman@candle.pha.pa.us>
To: gearond@cvc.net
Cc: Dann Corbit <DCorbit@connx.com>
Cc: Denis <denis@next2me.com>
Cc: pgsql-performance@postgresql.org
Cc: pgsql-general@postgresql.org
Cc: pgsql-sql@postgresql.org
Subject: Re: [PERFORM] Yet Another (Simple) Case of Index not used
Date: Tue, 15 Apr 2003 17:29:45 +0100
Message-ID: <200304151729.45657.dev@archonet.com> (raw)
In-Reply-To: <200304151423.h3FENUf06986@candle.pha.pa.us>
References: <200304151423.h3FENUf06986@candle.pha.pa.us>
On Tuesday 15 Apr 2003 3:23 pm, Bruce Momjian wrote:
> Dennis Gearon wrote:
> > from mysql manual:
> > -------------------------------------------------------------
> > "COUNT(*) is optimized to return very quickly if the SELECT retrieves
> > from one table, no other columns are retrieved, and there is no WHERE
> > clause. For example:
> >
> > mysql> select COUNT(*) from student;"
> > -------------------------------------------------------------
> The cleanest way would probably be to create an aggregate cache system
> table, and to insert into it when someone does an unqualified aggregate,
> and to delete from it when someone modifies the table --- the MVCC tuple
> visibility rules are handled automatically. Queries can look in there
> to see if a visible cached value already exists. Of course, the big
> question is whether this would be a big win, and whether the cost of
> upkeep would justify it.
If the rule system could handle something like:
CREATE RULE quick_foo_count AS ON SELECT count(*) FROM foo
DO INSTEAD
SELECT quick_count FROM agg_cache WHERE tbl_name='foo';
The whole thing could be handled by user-space triggers/rules and still
invisible to the end-user.
--
Richard Huxton
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-sql@postgresql.org
Cc: dev@archonet.com, pgman@candle.pha.pa.us, gearond@cvc.net, DCorbit@connx.com, denis@next2me.com, pgsql-performance@postgresql.org, pgsql-general@postgresql.org
Subject: Re: [PERFORM] Yet Another (Simple) Case of Index not used
In-Reply-To: <200304151729.45657.dev@archonet.com>
* 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