Last Updated: May 3, 2026
Regular CTEs name intermediate steps, but each step runs exactly once. That works for flat data. It does not work when the data refers back to itself, like a genre tree where "Electronic" contains "House" which contains "Deep House," or a management chain where one artist manages another who manages a third.
Recursive CTEs let a CTE reference itself, running repeatedly until there are no more rows to process.