DEV Community

Discussion on: How To Write Better SQL: Advanced SQL Episode 2 - Please Stop Using So Many CTEs

Collapse
 
alexantra profile image
Alex Antra

Yes 100000000000000% this.

CTE’s in some environments are actually extremely taxing on the resources. Distributed processing platforms like Redshift are forced to copy the CTE to every node involved the query which when you are dealing with hundreds of millions of rows of data SLOWS the query down.

I ban the use of CTE in our production code and only allow them when people are querying away.

Great article !!