On Sat, Oct 19, 2019 at 11:52 PM Tomas Vondra
<tomas.vondra@2ndquadrant.com> wrote:
> I wonder if an extension could do something like that, though. It can
> install a hook after parse analysis, so I guess it could walk the CTEs
> and mark them as materialized.
I wonder if the existing pg_hint_plan extension could be extended to
do that using something like /*+ MATERIALIZE */. That'd presumably be
ignored when not installed/not understood etc. I've never used
pg_hint_plan myself and don't know how or how well it works, but it
look like it supports Oracle-style hints hidden in comments like /*+
HashJoin(a b) */ rather than SQL Server-style hints that are in the
SQL grammar itself like SELECT ... FROM a HASH JOIN b.