4 ms·
Something painful I just learned today is that even Postgres >= 12 isn't that great with planning CTEs. Querying the same CTE twice seems to force it into mater
by arcticfox 5y ago
Something painful I just learned today is that even Postgres >= 12 isn't that great with planning CTEs. Querying the same CTE twice seems to force it into materializing the CTE just like Postgres <12 used to do.
Fortunately there's a workaround - using the `with .. as not materialized ()` hint sped up my query 100x.
- jeltz 5y agoYeah, the only thing PosgtreSQL 12 did was to remove the optimization fence. There was no additional optimizer logic added.