Re: Pull up aggregate sublink (was: Parameterized aggregate subquery (was: Pull up aggregate subquery))
| От | Tom Lane |
|---|---|
| Тема | Re: Pull up aggregate sublink (was: Parameterized aggregate subquery (was: Pull up aggregate subquery)) |
| Дата | |
| Msg-id | 8419.1311778273@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Re: Pull up aggregate sublink (was: Parameterized aggregate subquery (was: Pull up aggregate subquery)) (Yeb Havinga <yebhavinga@gmail.com>) |
| Список | pgsql-hackers |
Yeb Havinga <yebhavinga@gmail.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
В списке pgsql-hackers по дате отправления: