30.06.2013 Views

Performance Tuning with SQL Server Dynamic Management Views

Performance Tuning with SQL Server Dynamic Management Views

Performance Tuning with SQL Server Dynamic Management Views

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 5: Indexing Strategy and Maintenance<br />

• sys.dm_db_missing_index_groups – a DMV that provides details of missing<br />

indexes in a specific group; this is the intermediate join table between sys.dm_db_<br />

missing_index_details and sys.dm_db_missing_index_group_stats.<br />

Napoleon Bonaparte stated that a good sketch is better than a long speech. I promise<br />

that this is my one and only quote from a 19th century French dictator in this book,<br />

but the adage is quite appropriate in this case. Figure 5.4 shows the many-to-many<br />

relationship between missing_index_details and index_group_stats, via<br />

missing_index_groups.<br />

The first thing to note is that there is no index_id in any of the missing index DMOs.<br />

This is because the returned results are recommendations for indexes which have yet<br />

to be created, and are therefore non-materialized. The unique identifier for the records<br />

in these DMVs is the index_handle column, which is unique across the entire <strong>SQL</strong><br />

<strong>Server</strong> instance.<br />

The data stored by each of these DMOs is reset on a server restart. This is why it is so<br />

important to preserve this cumulative data and keep your instances in a constantly<br />

running state; you need to make sure, when you use this data, that the stored statistics<br />

are fully representative of your normal query workload. One service restart, and your<br />

accrued history (and the ability to generate meaningful results for this and other<br />

DMV-based queries) is, pardon the pun, history.<br />

Furthermore, the data stored in these DMOs is also volatile and based on active queries.<br />

By implementing a single new index on a given table or view, the results of the DMO<br />

query for that object may no longer be valid.<br />

200

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!