Re: optimizer questions - Mailing list pgsql-hackers

From Tom Lane
Subject Re: optimizer questions
Date
Msg-id 19880.1139939131@sss.pgh.pa.us
Whole thread Raw
In response to optimizer questions  (hector Corrada Bravo <hcorrada@gmail.com>)
List pgsql-hackers
hector Corrada Bravo <hcorrada@gmail.com> writes:
> 1) Regardless of the optimization problem, is the executor able to
> execute aggregate nodes within join trees (that is, not as the result
> of subqueries)?

Sure.

> 3) For debugging purposes: Has anyone figured out a way to feed
> hand-crafted plans to the executor? Setting up some of the data
> structures (PlannerInfo, target lists) etc. does not look trivial. By
> this I mean, beyond giving explicit join clauses in queries.

It's not really very practical --- the data structures are too complex
to create by hand in any reasonable way.  You can probably test by
entering modified queries that do the aggregations in sub-selects,
though.

The most practical way to implement something like this is probably to
restructure the query during the "prep" stage, pushing the aggregates
down into sub-queries automatically.  The 8.1 min/max optimization code
does something related, although I'll freely admit that's a bit of a hack.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Patch Submission Guidelines
Next
From: James William Pye
Date:
Subject: Re: Copy From & Insert UNLESS