>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.