/plushcap/analysis/hex/stop-using-so-many-ctes

Stop using so many CTEs

What's this blog post about?

CTEs (Common Table Expressions) are temporary, named result sets that can be referenced within the same query. They were introduced in SQL in 2005 and have become popular due to their modularity, reusability, recursion, and referenceability. However, they can only be referenced in the same query where they were created, making debugging complex queries difficult. Chained SQL is a feature that allows breaking up long CTE-based queries into separate chunks that can reference each other, improving readability and debuggability. Hex's Chained SQL automatically turns references to upstream results into CTEs behind the scenes, utilizing caching for efficient query execution.

Company
Hex

Date published
July 21, 2022

Author(s)
Claire Carroll

Word count
1035

Language
English

Hacker News points
2


By Matt Makai. 2021-2024.