Presentation is loading. Please wait.

Presentation is loading. Please wait.

Getting To Know Your Indexes

Similar presentations


Presentation on theme: "Getting To Know Your Indexes"— Presentation transcript:

1 Getting To Know Your Indexes
Microsoft SQL Server 2005/2008

2 Who Am I? Jason Strate SQL Server MVP
Enterprise Consultant with Digineer Working with SQL Server since 1997 tinyurl.com/StrateSQL twitter.com/StrateSQL

3 Session Agenda Session Goals Index Basics System Views Index DMVs
New Information

4 Session Agenda Session Goals Index Basics System Views Index DMVs
New Information

5 Session Goals Identify methods to analyze current and potential indexes Learn how to identify stress found on indexes Demonstrate methods for tuning indexes Usage patterns Maintenance weight

6 Last Year on an Airplane…
I Had Dream… What if… “I mix all index related DMVs with its metadata into a single query?”

7 I Hope So This Means Something…
Will we learn something new about indexes and their relationships? I Hope So

8 Session Agenda Session Goals Index Basics System Views Index DMVs
New Information

9 Index Basics Storage structure (B-Tree) associated with a table or view built from one or more columns (key values). The purpose of which is to improved data retrieval.

10 Index Basics Types Clustered – data rows stored with key values
Non-Clustered – key values stored with pointer to data row Heap – unordered structure Vary with properties of Filtered, Included, Unique Out-of-scope: Full-Text, Spatial, XML

11 Session Agenda Session Goals Index Basics System Views Index DMVs
New Information

12 Check Out The Indexes Methodology: Heaps or Clustered?
Identical Indexes Overlapping Indexes Objects sys.indexes sys.index_columns sys.dm_db_partition_stats Unique, primary key,

13 Foreign Keys? Methodology Index your foreign key columns. Objects:
sys.foreign_keys sys.foreign_key_columns

14 System Views DEMO

15 Session Agenda Session Goals Index Basics System Views Index DMVs
New Information

16 Captain Obvious Methodology Keep the indexes that you use Objects
sys.dm_db_index_usage_stats sys.dm_db_index_operational_stats

17 Captain Obvious, Again Methodology
Build indexes that your queries will find useful Objects sys.dm_db_missing_index_details sys.dm_db_missing_index_groups sys.dm_db_missing_index_group_stats

18 Is It Money? Methodology Is it worth the maintenance? Objects
sys.dm_db_index_operational_stats

19 Did I Just Say Maintenance?
Methodology Tuning is better than troubleshooting Object sys.dm_db_index_physical_stats

20 Index DMVs DEMO

21 Are You Burning Disk? Methodology
IO is resource intensive – are you managing it? Objects sys.dm_os_buffer_descriptors sys.allocation_units

22 Index DMVs DEMO

23 Session Agenda Session Goals Index Basics System Views Index DMVs
New Information

24 Pull It Together Index Analysis System Views DMVs

25 Should I Create The Index?
Scenario 2nd index on table 10th index on table 20th index on table Similarities It Depends

26 It Depends Should I Drop The Index? Scenario Index is hardly used.
Maybe it’s used to determine your bonus What’s the risk? It Depends

27 Code Word: It Depends Get the information you need
Table A and Table B have different needs Build a methodology around your databases Best practices are guidelines

28 Build A Methodology Analyze Add Monitor Remove

29 Remember Spend time getting to know your indexes regularly
Data changes. Usage changes. So indexing needs change DMV statistics are based on maintenance and service start times

30 Complete the Evaluation Form & Win!
You could win a Dell Mini Netbook – every day – just for handing in your completed form! Each session form is another chance to win! Pick up your Evaluation Form: Within each presentation room At the PASS Booth near registration area Drop off your completed Form: Near the exit of each presentation room Sponsored by Dell

31 for attending this session and the 2009 PASS Summit in Seattle
Thank you for attending this session and the PASS Summit in Seattle


Download ppt "Getting To Know Your Indexes"

Similar presentations


Ads by Google