Citus Blog

Archive for May 15, 2018

Craig Kerstiens

Fun with SQL: Recursive CTEs in Postgres

Written byBy Craig Kerstiens | May 15, 2018May 15, 2018

Common Table Expressions (CTEs) are a powerful construct within SQL. In day to day conversation, you may hear CTEs referred to as WITH clauses. You can think of CTEs as similar to a view that is materialized only while that query is running and does not exist outside of that query. CTEs can be very useful building blocks for allowing your large SQL queries to be more readable. But, they can also be used recursively allowing you to create some very complex queries without having to drop down to a procedural language like plpgsql or plv8.

Keep reading

Page 1 of 1