Re: Early WIP/PoC for inlining CTEs

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: Early WIP/PoC for inlining CTEs
Дата
Msg-id CA+TgmoapASa3RQi=DuSikPoPF4363czSD8KxbOxsfW5XmO3WpQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Early WIP/PoC for inlining CTEs  (Andreas Karlsson <andreas@proxel.se>)
Ответы Re: Early WIP/PoC for inlining CTEs  (Andres Freund <andres@anarazel.de>)
Re: Early WIP/PoC for inlining CTEs  (Andreas Karlsson <andreas@proxel.se>)
Список pgsql-hackers
On Thu, Jan 17, 2019 at 10:48 AM Andreas Karlsson <andreas@proxel.se> wrote:
> On 1/11/19 8:10 PM, Robert Haas wrote:
> > WITH cte_name [[NOT] MATERIALIZED] AS (query) main_query...
>
> Hm, when would one want "NOT MATERIALIZED"? I am not sure I see the
> usefulness of forcing inlining other than if we by default do not inline
> when a CTE is referenced multiple times.

When the planner materializes it, but the performance of the resulting
plan therefore sucks, I suppose.

I don't feel super-strongly about this, and Tom is right that there
may be cases where materialization is just not practical due to
implementation restrictions.  But it's not crazy to imagine that
inlining a multiply-referenced CTE might create opportunities for
optimization at each of those places, perhaps not the same ones in
each case, whereas materializing it results in doing extra work.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: pgsql: Restrict the use of temporary namespace in two-phase transaction
Следующее
От: Andres Freund
Дата:
Сообщение: Re: Early WIP/PoC for inlining CTEs