Working Around Missed Optimizations
In my last post, we saw how a query featuring a scalar aggregate could be transformed by the optimizer to a more efficient form. As a reminder, here’s the schema again: CREATE TABLE dbo.T1 (pk integer...
View ArticlePerformance Surprises and Assumptions : Arbitrary TOP 1
In a recent thread on StackExchange, a user had the following issue: I want a query that returns the first person in the table with a GroupID = 2. If nobody with a GroupID = 2 exists, I want the first...
View Article