Chapter 12. Reading query execution plans

When SQL Server is given a query to execute, it runs the query through an internal query optimizer. The optimizer looks at what the query is trying to do, what indexes are available to help, what condition those indexes are in, what load the server is currently handling, literally dozens of different factors. It considers all the ways it might execute the query—scanning a table, seeking in an index, and so on. There’s a limit on how long it’ll run through the permutations, because eventually it’ll be wasting time instead of running the query! At some point it’ll pick the best choice found by then, and that becomes the execution plan for that query. SQL Server then runs the plan, executing the query. ...

Get Learn SQL Server Administration in a Month of Lunches now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.