Re: [PERFORM] [GENERAL] Yet Another (Simple) Case of Index not used
От | Richard Huxton |
---|---|
Тема | Re: [PERFORM] [GENERAL] Yet Another (Simple) Case of Index not used |
Дата | |
Msg-id | 200304151729.45657.dev@archonet.com обсуждение исходный текст |
Ответ на | Re: [PERFORM] [GENERAL] Yet Another (Simple) Case of Index not used (Bruce Momjian <pgman@candle.pha.pa.us>) |
Список | 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
В списке pgsql-sql по дате отправления: