DATABASES Signal 129
How DuckDB Runs Recursive CTEs Faster
DuckDB now treats recursive CTEs as a single long-lived computation, retaining epoch-invariant state and optimizing execution mode selection based on frontier cardinality and physical work.
Recursive CTEs are critical for graph traversal, hierarchical queries, and iterative algorithms in analytical workloads. This change reduces overhead by avoiding repeated setup and teardown of execution pipelines, making recursive queries significantly faster without altering SQL semantics. Engineers building graph-based or recursive data processing pipelines in DuckDB will see immediate performance gains.
Written by elseif from the cluster below · every claim links back to a sourceThe three things worth knowing
DuckDB’s recursive CTE engine now retains reusable state across iterations, eliminating redundant pipeline scheduling and operator setup.
Execution modes are dynamically chosen based on exact frontier cardinalities and physical work estimates, improving efficiency.
The `USING KEY ... UNION` construct now supports changed-key semantics, enabling direct probes into keyed state for faster lookups.
THE CLUSTER