4 ms·
CTEs used to be "optimization fences" in PostgreSQL, but that changed with v12. https://www.depesz.com/2019/02/19/waiting-for-postgresql-12-allow-user-control-o
by jvolkman 4y ago
CTEs used to be "optimization fences" in PostgreSQL, but that changed with v12. https://www.depesz.com/2019/02/19/waiting-for-postgresql-12-allow-user-control-of-cte-materialization-and-change-the-default-behavior/ https://www.depesz.com/2019/02/19/waiting-for-postgresql-12-...
- DevX101 4y agoThis blog has a VERY high signal to noise ratio for anyone interested in digging into the PostgreSQL internals. Lots of great articles.
- srcreigh 4y agoThey still are sometimes. Whenever you have a CTE which is referenced more than once, to be specific.
- heresjohnny 4y agoSimilarly, joining a CTE to itself can also be problematic. In that case materializing to a temp table can be faster.