Press "Enter" to skip to content

The Performance Cost of Subqueries in the SELECT Clause

Andrea Allred notes a potential performance issue:

Why is this query slow? If this query were to return 50 rows, it would run each query in the SELECT clause 50 times, and since there are two of them, that is 100 query runs. What if I returned 100,000 rows? That would be 200,000 query runs. How could I do this differently?

Read on for the answer.