Skip to main content

Module materialized_cte

Module materialized_cte 

Source
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§

MaterializedCte
Computes cte once and evaluates continuation, in which every MaterializedCteScan with the same id reads the buffered output of cte. The output of this node is the output of continuation.
MaterializedCteId
Identifies one materialized CTE and binds its scans to it.
MaterializedCteScan
Reads the buffered output of the MaterializedCte with the same id.

Enums§

MaterializedCtePlan
A node of a materialized CTE, in LogicalPlan::MaterializedCte.