Skip to Main Content
Learn T-SQL Querying
book

Learn T-SQL Querying

by Pedro Lopes, Pam Lahoud
May 2019
Intermediate to advanced content levelIntermediate to advanced
484 pages
11h 23m
English
Packt Publishing
Content preview from Learn T-SQL Querying

Plans with missing indexes

In the Query plan properties of interest section of Chapter 4, Exploring Query Execution Plans, we discussed the MissingIndexes property. If this property exists in a query execution plan, it means that there is at least one index that SQL Server could have benefited from that does not exist.

The following query uses DMVs to list all the missing index suggestions on the server:

SELECT DB_NAME(d.database_id) as [database_name],              OBJECT_NAME(d.object_id, d.database_id)ASobject_name,              total_cost_savings =                 ROUND(s.avg_total_user_cost * s.avg_user_impact *(s.user_seeks + s.user_scans),0)/100,              s.avg_total_user_cost, s.avg_user_impact, s.user_seeks, s.user_scans, d.equality_columns, d.inequality_columns, d.included_columns ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learn T-SQL Querying - Second Edition

Learn T-SQL Querying - Second Edition

Pedro Lopes, Pam Lahoud
SQL Server T-SQL Recipes, Fourth Edition

SQL Server T-SQL Recipes, Fourth Edition

Jason Brimhall, Jonathan Gennick, Wayne Sheffield

Publisher Resources

ISBN: 9781789348811Supplemental Content