Feature Description

Inlined Common Table Expressions (WITH queries)

A WITH query that is neither recursive nor has any side-effects (e.g. an INSERT/UPDATE/DELETE) can be executed inline, which can lead to performance improvements. This behavior can be forced on a query by using the "NOT MATERIALIZED" clause, e.g. WITH cte AS NOT MATERIALIZED ( SELECT * FROM a ) SELECT * FROM cte JOIN b ON b.id = cte.id; https://www.postgresql.org/docs/12/queries-with.html