From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Yeb Havinga <yebhavinga(at)gmail(dot)com> |
Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Pull up aggregate sublink (was: Parameterized aggregate subquery (was: Pull up aggregate subquery)) |
Date: | 2011-07-27 14:51:13 |
Message-ID: | 8419.1311778273@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Yeb Havinga <yebhavinga(at)gmail(dot)com> writes:
> Tom and Robert, thank you both for your replies. I think I'm having some
> blind spots and maybe false assumptions regarding the overal work in the
> optimizer, as it is not clear to me what 'the same sort of query' would
> look like. I was under the impression that using cost to select the best
> paths is only done per simple query, and fail to see how a total
> combined plan with pulled up subquery could be compared on cost with a
> total plan where the subquery is still a separate subplan, since the
> range tables / simple-queries to compare are different.
Well, you could look at what planagg.c does to decide whether an
indexscan optimization of MIN/MAX is worthwhile, or at the calculations
in planner.c that decide which way to do grouping/aggregation/ordering.
It could be fairly expensive to handle this type of problem because of
the need to cost out two fundamentally different scan/join trees, but
we're assuming the queries are expensive enough to make that worthwhile
...
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2011-07-27 15:21:52 | Re: psql: bogus descriptions displayed by \d+ |
Previous Message | Alexander Korotkov | 2011-07-27 14:43:26 | Re: WIP: Fast GiST index build |