Hacker News new | ask | show | jobs
by c2h5oh 1903 days ago
CTE advice is somewhat questionable, as it is database specific.

CTEs were for a very long time an optimization fence in PostgreSQL, were not inlined and behaved more like temporary materialized views.

Only with release of PostgreSQL 12 some CTE inlining is happening - with limitations: not recursive, no side-effects and are only referenced once in a later part of a query.

Mode info: https://hakibenita.com/be-careful-with-cte-in-postgre-sql