From: | Mark Kirkwood <markir(at)coretech(dot)co(dot)nz> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | MAX/MIN optimization via rewrite (plus query rewrites generally) |
Date: | 2004-11-10 22:48:49 |
Message-ID: | 41929AD1.4050603@coretech.co.nz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Sullivan | 2004-11-10 22:51:01 | Re: Increasing the length of |
Previous Message | Bruce Momjian | 2004-11-10 22:01:02 | Beta time early next week |