Re: Pull up aggregate subquery

Поиск
Список
Период
Сортировка
От Hitoshi Harada
Тема Re: Pull up aggregate subquery
Дата
Msg-id BANLkTikT0KMpPJPfgqfanVVm94v5w65kkw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Pull up aggregate subquery  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
2011/5/26 Tom Lane <tgl@sss.pgh.pa.us>:
> Hitoshi Harada <umi.tanuki@gmail.com> writes:
>> 2011/5/25 Hitoshi Harada <umi.tanuki@gmail.com>:
>>> So I'm still
>>> thinking which of pulling up and parameterized scan is better.
>
>> After more investigation I came up with third idea, pushing down
>> RangeTblEntry to aggregate subquery. This sounds like a crazy idea,
>
> Yes, it sure does.  Won't that typically change the number of rows
> produced by the subquery's jointree?  And thus possibly change the
> aggregate's result?

No, because it will be restricted to assumption that join qual ==
grouping key and outer relation is unique on the var in that join
qual. Pushing down the baserel to sub-aggregate is equivalent to
pulling up sub-aggregate eventually if there are only two relations
(which is my first example.) The difference is if the optimizer needs
to care about other relations which may change the number of rows
produced.

Regards,

--
Hitoshi Harada


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [ADMIN] pg_class reltuples/relpages not updated by autovacuum/vacuum
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Nested CASE-WHEN scoping