Expand description
Logical nodes for WITH x AS MATERIALIZED (...).
A materialized CTE is planned as one MaterializedCte node, which owns
the CTE body and the rest of the query (the “continuation”), and one
MaterializedCteScan leaf for each reference to the CTE inside the
continuation. Both are in the LogicalPlan::MaterializedCte variant,
as cases of MaterializedCtePlan. The body is therefore optimized and executed once, and
the scans read its buffered output.
The scans are leaves, so filters and projections of one reference are not
pushed into the shared body. This is the same optimization fence that
PostgreSQL applies to MATERIALIZED CTEs.
Structs§
- Materialized
Cte - Computes
cteonce and evaluatescontinuation, in which everyMaterializedCteScanwith the sameidreads the buffered output ofcte. The output of this node is the output ofcontinuation. - Materialized
CteId - Identifies one materialized CTE and binds its scans to it.
- Materialized
CteScan - Reads the buffered output of the
MaterializedCtewith the sameid.
Enums§
- Materialized
CtePlan - A node of a materialized CTE, in
LogicalPlan::MaterializedCte.