3 ms·
In postgresql 12 a patch [0] is merged to remove the optimization fence certain conditions. From the changelog [1] " Allow common table expressions (CTEs) to b
by tda 6y ago
In postgresql 12 a patch [0] is merged to remove the optimization fence certain conditions. From the changelog [1]
"
Allow common table expressions (CTEs) to be inlined into the outer query (Andreas Karlsson, Andrew Gierth, David Fetter, Tom Lane)
Specifically, CTEs are automatically inlined if they have no side-effects, are not recursive, and are referenced only once in the query. Inlining can be prevented by specifying MATERIALIZED, or forced for multiply-referenced CTEs by specifying NOT MATERIALIZED. Previously, CTEs were never inlined and were always evaluated before the rest of the query.
"
[0] https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=608b167f9f9c4553c35bb1ec0eab9ddae643989b https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit...
[1] https://www.postgresql.org/docs/12/release-12.html https://www.postgresql.org/docs/12/release-12.html