Re: [HACKERS] CTE inlining - Mailing list pgsql-hackers

From Adam Brusselback
Subject Re: [HACKERS] CTE inlining
Date
Msg-id CAMjNa7dvpNKmXCmKzsvBCuw03muyE2FCTZqtj2qZBE3ynrk96w@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] CTE inlining  (Bruce Momjian <bruce@momjian.us>)
List pgsql-hackers
From a user's perspective:

>I think most people prefer #2 because:

>*  most users writing queries prefer #2
>*  most users assume full optimization and it seems natural to turn
>   _off_ an optimization via a keyword
>*  while some queries can be inlined, all queries can be materialized,
>   so doing #1 means INLINE would be only a preference, which could be
>   confusing

I completely agree with this reasoning.  I have a few queries I would have to touch to add "MATERIALIZED", but the vast majority of CTE's in my codebase would get a speedup. It would allow usage of CTE's more freely than now.  I currently avoid them unless it really simplifies a query because of the optimization fence.

Not that my opinion holds any weight, but the extra keyword for enabling the optimization fence is my preference.  By default trying to optimize more is a good thing IMO.

>Anyway, I am very glad we are considering addressing this in PG 11.

Seconded, this is a sore spot for me when using Postgres, and i'd love to not have it be an issue any more.

Thanks,
-Adam

pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: [HACKERS] postgres 9.6.2 update breakage
Next
From: Mark Dilger
Date:
Subject: Re: [HACKERS] Event triggers + table partitioning cause server crash in current master