Re: MAX/MIN optimization via rewrite (plus query rewrites

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Mark Kirkwood <markir(at)coretech(dot)co(dot)nz>
Cc: "Jim C(dot) Nasby" <decibel(at)decibel(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: MAX/MIN optimization via rewrite (plus query rewrites
Date: 2004-11-11 05:44:42
Message-ID: 20041111054442.GA6138@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Nov 11, 2004 at 17:57:42 +1300,
Mark Kirkwood <markir(at)coretech(dot)co(dot)nz> wrote:
> Your example and ones like :
>
> SELECT max(foo), count(foo) FROM bar
> SELECT max(a.foo1), max(b.foo2) FROM bar1 AS a NATURAL JOIN bar2 AS b
>
> have made me realize that the scope of "what should be optimized" is
> somewhat subtle.
>
> I am inclined to keep it simple (i.e rather limited) for a first cut,
> and if that works well, then look at extending to more complex rewrites.
>
> What do you think?

I don't think you should be rewriting queries as much as providing
alternate plans and letting the rest of the optimizer decided which
plan to use. If you just rewrite a query you might lock yourself into
using a poor plan.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2004-11-11 06:08:39 Re: MAX/MIN optimization via rewrite (plus query rewrites generally)
Previous Message Bruce Momjian 2004-11-11 05:03:25 Vacuum info clarification