Good CTE, Bad CTE
https://boringsql.com/posts/good-cte-bad-cte/
#HackerNews #GoodCTE #BadCTE #SQL #DataAnalysis #BoringSQL #HackerNews
The planner treats CTEs very differently depending on how you write them. Here's what happens under the hood, version by version, through PostgreSQL 18.