MAX/MIN optimization via rewrite (plus query rewrites generally)

Поиск
Список
Период
Сортировка
От Mark Kirkwood
Тема MAX/MIN optimization via rewrite (plus query rewrites generally)
Дата
Msg-id 41929AD1.4050603@coretech.co.nz
обсуждение исходный текст
Ответы Re: MAX/MIN optimization via rewrite (plus query rewrites generally)  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: MAX/MIN optimization via rewrite (plus query rewrites generally)  ("Jim C. Nasby" <decibel@decibel.org>)
Re: MAX/MIN optimization via rewrite (plus query  (Simon Riggs <simon@2ndquadrant.com>)
Re: MAX/MIN optimization via rewrite (plus query rewrites  (Mark Kirkwood <markir@coretech.co.nz>)
Список pgsql-hackers
I am looking at implementing this TODO item. e.g. (max case):

rewrite
SELECT max(foo) FROM bar
as
SELECT foo FROM bar ORDER BY foo DESC LIMIT 1
if there is an index on bar(foo)

Suggestions about the most suitable point in the parser/planner stage to 
perform this sort of rewrite would be most welcome! (as this would be my 
first non trivial getting of hands dirty in the code).

My initial thoughts revolved around extending the existing RULE system 
to be able to handle more general types of rewrite - like conditionals 
in SELECT rules and rewrites that change elements of the query other 
than the target relation.

Planning for future note: I would like whatever mechanism that is added 
for this MAX/MIN stuff to be amenable to more subtle things like 
aggregate navigation (see R.Kimball's article 
http://www.dbmsmag.com/9608d54.html).

regards

Mark


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Beta time early next week
Следующее
От: Andrew Sullivan
Дата:
Сообщение: Re: Increasing the length of