DEV Community

[Comment from a deleted post]
Collapse
 
smartcodinghub profile image
Oscar

There are a lot of comments about de error on CTEs and in-memory, and I will ignore this point.

About joins and subqueries (a CTE is a subquery):

For these queries, you can add your where to the join. This way, the database will do the filtering before the join. Doing this, you can achieve the same performance with less code.