On Tue, Mar 22, 2011 at 01:02, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> I studied the code some more, and I think this probably can be made to
> work. The basic idea is to have preprocess_minmax_aggregates build
> simplified queries like the above (working by modifying the query tree
> that exists at the point where it's called) and call query_planner on
> them. Save aside the resulting path data, then let the regular planning
> process continue. When optimize_minmax_aggregates is called, see
> whether the regular plan is cheaper than the sum of the path costs.
> If not, use the paths to construct a replacement plan, same as now.
Thanks a lot! I can confirm that this is fixed now in git version, and
now also works with partitioned tables, which is great news.
Regards,
Marti