Site sponsored by: Idera Try Idera’s new SQL admin toolset
SQL Server Performance

  • Home
  • Articles
  • Forums
  • Tips
  • Quiz
  • FAQ's
  • Blogs
  • Software
  • Books
  • About Us
RSS Feeds
Sign in | Join


Article Topics

All Articles
Performance Tuning
Audit
Business Intelligence
Clustering
Reporting Services
Developer
General DBA
ASP.NET / ADO.NET

Write for Us

Share you SQL Server knowledge with others and raise your profile in the community More...
Latest Articles

Policy Based Management in SQL Server 2008
Inside SQL Server Cluster Setup and Troubleshooting Techniques - Part I ...
Configure and Manage Policy Based Management in SQL Server 2008 ...
Using Column Sets with Sparse Columns

More     
 
Latest FAQ's

Cannot Start SQL Server Service
Users are able to connect to report manager but not able ...
Errors when SQL Server Snapshot Replication is Running
How to Display Server Name or IP Address in a Reporting ...

More     
   
Latest Software Reviews

Spotlight on ApexSQL Doc 2008
ApexSQL Enforce
Embarcadero Change Manager
SQL Server DBA Dashboard

More     

articles >> performance tuning >> Index related DMVs and DMFs - sys.dm_db_index_usage_stats ...

Index related DMVs and DMFs - sys.dm_db_index_usage_stats

By : Dinesh Priyankara
Oct 09, 2007

Page 2 / 3

What does user_lookups gives us?

You might already have noticed that this column for the clustered index gets updated whenever we execute query 6 and query 7. This is because SQL Server needs to perform a Key Lookup operation in order to get the columns’ values that are not available in the index. If this happens for a table with many columns and many records the Key Lookup operation may hinder the performance. You may measure it by looking at IO values too. If you see a growth in user_lookups of a clustered index relatively to either seek or scan operation of the non-clustered index, and if you believe that IO operations that are involved with related queries are high, you may need to consider modifying the index. For example, if you add the SomeValue2 column as included column to the index, you can avoid Key Lookup operation because it makes the index as covered index and it has all values for giving out data to the above queries.

-- query 8
drop
index ix_TestTable_SomeDate on dbo.TestTable
go

create
index ix_TestTable_SomeDate on dbo.TestTable(SomeDate)  include (SomeValue2)
go

Once you run query 8 and run either query 6 or query 7, you will notice that there are no lookup operations for both queries. Run the query 4 after running these and examine the output. The value of user_lookup has not increased.

What does user_updates give us?

This shows the number of updates performed by the user for the index. You probably have noticed that initially the values for both clustered and non-clustered columns are zero but after inserting records, the values of both rows become 1000. Try the below queries and see change of user_updates column.

-- query 9
-- this causes both clustered index and non-clustered index updates

update
dbo.TestTable
set
SomeValue2 = newid()
where
SomeDate = '2026-12-27'

-- run query 4

-- query 10
-- this causes only clustered index update

update
dbo.TestTable
set
SomeValue1 = newid()
where
SomeDate = '2026-12-27'

-- run query 4

-- query 11
-- this causes both clustered index and non-clustered index updates

delete
dbo.TestTable
where
SomeDate = '2026-12-27'

-- run query 4

Query 9 and query 11 update both indexes but query 10 updates only the clustered index. Note that the non-clustered index gets updated when query 9 is executed because SomeValue2 has been added to the index as an included column. Again it gets updated with query 10 because the query updates the keys of the index.

Again this column can help us understand the usability of the index. Sometime we get misguided by either user_seeks or user_scans columns values because they get increased by the UPDATE and DELETE statements. If we have created the index for querying, we expect the increase of user_seeks (or user_scans) and if one of counters has been increased because of either UPDATE or DELETE, it may lead us to think as the index is being used for queries. Because of this, we need to be careful when judging the index by looking at either user_seeks or user_scans; consider the value of user_updates if the value is relatively high too.


<< Prev Page     Next Page>>    








Home | Peformance Articles | Audit Articles | Business Intelligence Articles | Clustering Articles | Developer Articles | Reporting Services Articles | DBA Articles | ASP.NET / ADO.NET Articles | DBA FAQ's | Developer Peformance FAQ's | DBA Peformance FAQ's | Developer FAQ's | Clustering FAQ's | Error Messages | Audit Tool Reviews | Backup Tool Reviews | Coding Tool Reviews | Compare Tool Reviews | Documentation Tool Reviews | Design Tool Reviews | Monitoring Tool Reviews | Log Tool Reviews | Reporting Tool Reviews | Clustering Tool Reviews | Security Tool Reviews | Change Management Tool Reviews | Remote Access Tool Reviews | Book Reviews | Security Tool Reviews | QDPMA Performance Tuning | ADO.NET / ASP.NET | Administration | Analysis/OLAP Services | Application Development | Configuration | Components | ETL | Hardware | High Availability | Hints | Index | Misc | Operating Systems | Performance Tuning | Replication | T-SQL | Views


              © 1999-2008 by T10 Media. All rights reserved