DATETIME SELECT SELECT INTO DATE PAD STRING DYNAMIC SQL CURSOR MONEY FORMAT PERCENT STORED PROCEDURE SQL SERVER AGENT JOB OPTIMIZATION WHILE LOOP OVER PARTITION BY UPDATE
 
 
SITE SEARCH SQLUSA.com VIDEOS
 
 
SQL E/BOOKS   WORLD, USA & SQL NEWS   FORMAT
SCRIPTS SQL 2005 SQL 2008 ARTICLES
How to find missing indexes?

Execute the following Microsoft SQL Server T-SQL script in SSMS Query Editor to a list of missing indexes with seek statistics. To design a new index with CREATE INDEX statement : equality columns should be put before the (different) inequality columns, and together they should make the key of the index. Included columns should be added using the INCLUDE clause. Columns with low seek counts should be ignored.

SELECT   object_name(mid.object_id) AS TableName,

         migs.user_seeks            AS Seeks,

         mid.equality_columns       AS Equality,

         mid.inequality_columns     AS Inequality,

         mid.included_columns       AS Included,

         mid.statement              AS [Statement]

FROM     sys.dm_db_missing_index_details mid

         JOIN sys.dm_db_missing_index_groups mig

           ON mid.index_handle = mig.index_handle

         JOIN sys.dm_db_missing_index_group_stats migs

           ON migs.group_handle = mig.index_group_handle

WHERE    database_id = db_id()

ORDER BY TableName

GO

Related articles:

Are you using SQL's Missing Index DMVs?

About the Missing Indexes Feature

 

Exam Prep 70-461
SQL 2016 DESIGN & PROGRAMMING
 
 
 
DATETIME SELECT SELECT INTO DATE PAD STRING DYNAMIC SQL CURSOR MONEY FORMAT PERCENT STORED PROCEDURE SQL SERVER AGENT JOB OPTIMIZATION WHILE LOOP OVER PARTITION BY UPDATE