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 />

Figure 5.2: Both the master and AdventureWorks databases have an object identified by<br />

object_id = 4 and index_id = 1.<br />

This is why we had to filter the results by database in the WHERE clause in Listing 5.1. That<br />

allows us to run this query under the context of any database and still receive the same<br />

results. Alternatively, we could have used WHERE ddius.[database_id] = DB_ID().<br />

However, we would then have had to run the query under the context of the Northwind<br />

database in order to return the same results.<br />

Occasionally, we may need to join to other indexing catalog views, such as sys.columns,<br />

to find out details about specific columns in the index, such as their length, data type, and<br />

so on. When we do so, we need to join via the intermediate view, sys.index_columns,<br />

as shown in Figure 5.3.<br />

176

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

Saved successfully!

Ooh no, something went wrong!