Hi all,

I’d like to share an update on the development of the CTE (Common Table
Expression) materialization feature.

1. Grammar
We plan to introduce the MATERIALIZED keyword to explicitly specify a
materialized CTE:

with_clause:
    WITH cte_name [(col_name [, col_name] ...)] AS [ MATERIALIZED ]
(subquery)
When marked as MATERIALIZED, the subquery will be materialized so that it
is not repeatedly executed in subsequent query nodes.

2. Restrictions
No spill-to-disk support — if the CTE returns a large volume of data and
the memory usage exceeds the designated threshold, the engine will
automatically fall back to inline mode.

3. Next Steps
EXPLAIN and EXPLAIN ANALYZE are still under development and will be added
to help users understand and analyze the execution plan involving
materialized CTEs.

Reply via email to