How to Think Like the SQL Server Engine

How to Think Like the SQL Server Engine: Adding a Nonclustered Index

When we left off in the last post, our users kept running this query, and they want it to be really fast: Transact-SQL SELECT Id FROM dbo.Users WHERE LastAccessDate > '2014/07/01' ORDER BY LastAccessDate; 1234 SELECT Id   FROM dbo.Users   WHERE LastAccessDate > '2014/07/01'   ORDER BY LastAccessDate; Let’s pre-bake the data by creating a copy of…
Read More

How to Think Like the SQL Server Engine: The Perils of SELECT *

In our last post, we ran a query with an ORDER BY, but we only got one column in the SELECT: Transact-SQL SELECT Id FROM dbo.Users WHERE LastAccessDate > '2014/07/01' ORDER BY LastAccessDate; 1234 SELECT Id   FROM dbo.Users   WHERE LastAccessDate > '2014/07/01'   ORDER BY LastAccessDate; The estimated cost was about $18 Query Bucks because SQL…
Read More

How to Think Like the SQL Server Engine: Adding an ORDER BY

We started out the How to Think Like the Engine series with a simple query with a WHERE clause: Now let’s add an ORDER BY: Transact-SQL SELECT Id FROM dbo.Users WHERE LastAccessDate > '2014/07/01' ORDER BY LastAccessDate; 1234 SELECT Id   FROM dbo.Users   WHERE LastAccessDate > '2014/07/01'   ORDER BY LastAccessDate; Here’s the updated plan – note…
Read More
Menu
{"cart_token":"","hash":"","cart_data":""}