1 / 10

Effective Indexes For Beginners

Effective Indexes For Beginners. Performance is slow. Let’s add another index!. 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.

vanna
Download Presentation

Effective Indexes For Beginners

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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

  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. Demo...

  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 • BOL sys.dm_db_index_usage_stats information page: http://tinyurl.com/qpfa4d • Useful blog article on managing indexes at a more detailed level: http://tinyurl.com/38fb5v • Blog: http://nzgirlgeek.blogspot.com • Web: www.aucklandsql.com www.girlgeekdinners.co.nz • Email: amanda@aucklandsql.com

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

More Related