Re: [PERFORM] Yet Another (Simple) Case of Index not used

From: Richard Huxton <dev(at)archonet(dot)com>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, gearond(at)cvc(dot)net
Cc: Dann Corbit <DCorbit(at)connx(dot)com>, Denis <denis(at)next2me(dot)com>, pgsql-performance(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Re: [PERFORM] Yet Another (Simple) Case of Index not used
Date: 2003-04-15 16:29:45
Message-ID: 200304151729.45657.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-performance pgsql-sql

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message scott.marlowe 2003-04-15 16:31:01 Re: How to change data type in column ?
Previous Message scott.marlowe 2003-04-15 16:18:28 Re: Are we losing momentum?

Browse pgsql-performance by date

  From Date Subject
Next Message scott.marlowe 2003-04-15 16:34:21 Re: for help!
Previous Message Robert John Shepherd 2003-04-15 15:49:18 Do Views offer any performance advantage?

Browse pgsql-sql by date

  From Date Subject
Next Message Pedro Igor Craveiro e Silva 2003-04-15 17:00:52 accent problems
Previous Message rute solipa 2003-04-15 15:52:07 help need it