re: Why I use SQL Common Table Expressions (CTEs) VIEW POST

re: Other drawbacks: You are transferring an application logic from an app server to DB server. If your DB server has 1-2 CPUs do not expect improvem...

I think those are valid concerns for application development when users will be hitting your database with this query 100's or 1000's of times. In that case, you probably have the right to ask for another table or some other optimization.

The case that @helenanders26 is talking about here is more for an analyst that may not have to write privileges to the database and is not likely hammering it with the power of every user of the application. The main point is that it greatly improves readability.

Both are great points but from different perspectives.


Sure, this would be of concern if you need to implement reporting on top of a live database performing OLTP workloads. If you have the benefit of a dedicated database/server these points, except the data transfer amplification, should not have any negative impact.

code of conduct - report abuse