Presentation is loading. Please wait.

Presentation is loading. Please wait.

Effective Indexes For Beginners. Performance is slow Let’s add another index!

Similar presentations


Presentation on theme: "Effective Indexes For Beginners. Performance is slow Let’s add another index!"— Presentation transcript:

1 Effective Indexes For Beginners

2 Performance is slow Let’s add another index!

3 Ineffective Indexes Insert, Update and Delete operations will be slower if you have too many indexes on your table Indexes are stored on the disk, the more indexes you have, the more disk space you use

4 sys.dm_db_index_usage_stats Counts of different types of index operations Time each type of operation last performed. Requires VIEW SERVER STATE permission Counters reset to empty when SQL Server Service is restarted If the database is detached or shutdown, all rows associated with that DB are removed Information gathered is real-time

5 sys.dm_db_index_usage_stats Column Name database_idlast_user_update object_idsystem_seeks index_idsystem_scans user_seekssystem_lookups user_scanssystem_updates user_lookupslast_system_seek user_updateslast_system_scan last_user_seeklast_system_lookup last_user_scanlast_system_update last_user_lookup

6 On to the code… Pick a table and view its indexes Take a look at the current usage Run code that targets each index and see when the index was last used Recheck the usage View index usage for entire database How to disable an index How to enable an index How to drop an index

7

8 Conclusion Use sys.dm_db_index_usage_stats DMV to easily identify real-time index usage stats Identify indexes that are rarely or never used Disable for a time before dropping If disabled indexes aren’t missed – drop them to save disk space

9 Resources Click on the Word icon to the right to access the SQL code used in the practical element of this session. Download AdventureWorks2008 DBs for free here: http://tinyurl.com/c6y6a3 http://tinyurl.com/c6y6a3 BOL sys.dm_db_index_usage_stats information page: http://tinyurl.com/qpfa4d http://tinyurl.com/qpfa4d Useful blog article on managing indexes at a more detailed level: http://tinyurl.com/38fb5v http://tinyurl.com/38fb5v Blog: http://nzgirlgeek.blogspot.comhttp://nzgirlgeek.blogspot.com Web: www.aucklandsql.comwww.aucklandsql.com www.girlgeekdinners.co.nz Email: amanda@aucklandsql.comamanda@aucklandsql.com

10 Website: www.aucklandsql.com Mailing list: announce@aucklandsql.com


Download ppt "Effective Indexes For Beginners. Performance is slow Let’s add another index!"

Similar presentations


Ads by Google