Analysing Indexes SQLBits 6 th October 2007 © Colin Leversuch-Roberts Kelem Consulting Limited September 2007.

Slides:



Advertisements
Similar presentations
Module 13: Performance Tuning. Overview Performance tuning methodologies Instance level Database level Application level Overview of tools and techniques.
Advertisements

Big Data Working with Terabytes in SQL Server Andrew Novick
Database Management Systems 3ed, R. Ramakrishnan and Johannes Gehrke1 Evaluation of Relational Operations: Other Techniques Chapter 14, Part B.
Query Optimization 3 Cost Estimation R&G, Chapters 12, 13, 14 Lecture 15.
1 How to improve SQL Performance with new Health Check Tool? Carlos Sierra Consulting Technical Advisor © 2012 Oracle Corporation – Proprietary and Confidential.
Denny Cherry twitter.com/mrdenny.
Executing Explain Plans and Explaining Execution Plans Craig Martin 01/20/2011.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Database Performance Tuning and Query Optimization.
March 19981© Dennis Adams Associates Tuning Oracle: Key Considerations Dennis Adams 25 March 1998.
Module 7 Reading SQL Server® 2008 R2 Execution Plans.
Table Indexing for the.NET Developer Denny Cherry twitter.com/mrdenny.
Oracle9i Performance Tuning Chapter 12 Tuning Tools.
1 CS 430 Database Theory Winter 2005 Lecture 16: Inside a DBMS.
© 2008 Quest Software, Inc. ALL RIGHTS RESERVED. Perfmon and Profiler 101.
Denny Cherry twitter.com/mrdenny.
Interpreting DMV’s & practical uses Jannie Muller mullerjannie.wordpress.com.
CS4432: Database Systems II Query Processing- Part 2.
SQL/Lesson 7/Slide 1 of 32 Implementing Indexes Objectives In this lesson, you will learn to: * Create a clustered index * Create a nonclustered index.
SQL SERVER DAYS 2011 Table Indexing for the.NET Developer Denny Cherry twitter.com/mrdenny.
Relational Operator Evaluation. Overview Application Programmer (e.g., business analyst, Data architect) Sophisticated Application Programmer (e.g.,
Session 1 Module 1: Introduction to Data Integrity
School Census 2014 Secondary School Application Version 0.1.
Copyright © Andrew Couch 2007 All rights reserved. Access Tables Without Keys & Views How To Manage Keys On Access Tables Andrew Couch ASC Associates.
Student Centered ODS ETL Processing. Insert Search for rows not previously in the database within a snapshot type for a specific subject and year Search.
CPSC 203 Introduction to Computers T97 By Jie (Jeff) Gao.
Query Execution. Where are we? File organizations: sorted, hashed, heaps. Indexes: hash index, B+-tree Indexes can be clustered or not. Data can be stored.
IMS 4212: Database Implementation 1 Dr. Lawrence West, Management Dept., University of Central Florida Physical Database Implementation—Topics.
Database Systems, 8 th Edition SQL Performance Tuning Evaluated from client perspective –Most current relational DBMSs perform automatic query optimization.
Copyright Sammamish Software Services All rights reserved. 1 Prog 140  SQL Server Performance Monitoring and Tuning.
Dave LinkedIn
Scott Fallen Sales Engineer, SQL Sentry Blog: scottfallen.blogspot.com.
Execution Plans Detail From Zero to Hero İsmail Adar.
Why Should I Care About … The Plan Cache? Tuning When Stakeholders Won’t Say Where It Hurts.
Diving into Query Execution Plans ED POLLACK AUTOTASK CORPORATION DATABASE OPTIMIZATION ENGINEER.
Data Integrity & Indexes / Session 1/ 1 of 37 Session 1 Module 1: Introduction to Data Integrity Module 2: Introduction to Indexes.
Basic Outputs to Troubleshooting Queries.
Chris Index Feng Shui Chris
Cleveland SQL Saturday Catch-All or Sometimes Queries
How Good Is Your Indexing Strategy?
Power BI Performance Tips & Tricks
Design Patterns for SSIS Performance
Execution Planning for Success
UFC #1433 In-Memory tables 2014 vs 2016
Reading execution plans successfully
Reading Execution Plans Successfully
Let Me Finish... Isolating Write Operations
Introduction to Execution Plans
Marcos Freccia Stop everything! Top T-SQL tricks to a developer
Getting To Know Your Indexes
The Key to the Database Engine
Table Indexing for the .NET Developer
JULIE McLAIN-HARPER LINKEDIN: JM HARPER
Steve Hood SimpleSQLServer.com
Transactions, Locking and Query Optimisation
Reading Execution Plans Successfully
When I Use NOLOCK AND OTHER HINTS
Targeting Wait Statistics with Extended Events
Indexing For Optimal Performance
Troubleshooting Techniques(*)
Let Me Finish... Isolating Write Operations
Implementation of Relational Operations
When I Use NOLOCK AND OTHER HINTS
EXECUTION PLANS Quick Dive.
Evaluation of Relational Operations: Other Techniques
Diving into Query Execution Plans
Introduction to Execution Plans
Reading execution plans successfully
Introduction to Execution Plans
Lecture Topics: 11/20 HW 7 What happens on a memory reference Traps
Presentation transcript:

Analysing Indexes SQLBits 6 th October 2007 © Colin Leversuch-Roberts Kelem Consulting Limited September 2007

Who am I ? © Colin Leversuch-Roberts Kelem Consulting Limited September 2007 Colin Leversuch-Roberts aka Grumpy Old DBA Kelem Consulting Limited

Analysing Indexes How to gather the statistical information about database indexes What to do with it How to use it to your advantage How big is that index Missing Indexes © Colin Leversuch-Roberts Kelem Consulting Limited September

Analysing Indexes WHY ? Documentation Controlled environments Change Requests Change Advisory Board Meetings Urban Myths and would be DBA’s © Colin Leversuch-Roberts Kelem Consulting Limited September

Analysing Indexes No real demo’s My laptop can’t process a 400 million row table live Background ERP System, nearly 8000 indexes Would you believe how this application works? © Colin Leversuch-Roberts Kelem Consulting Limited September

Analysing Indexes Some typical tables © Colin Leversuch-Roberts Kelem Consulting Limited September

Analysing Indexes Some typical indexes All unique ? I think not ! © Colin Leversuch-Roberts Kelem Consulting Limited September

Where to start System views Data not persisted We must capture and store this data Operational cost on indexes ( assuming no RFI ) ** ( No partitioning ) ** 8 © Colin Leversuch-Roberts Kelem Consulting Limited September 2007

Tools of the trade 9 dbo.sysindexesThis is the SQL 2000 system table taken forward as a view. This table may not be supported going forward. sys.dm_db_index_physical_statsThis is actually a function and replaces dbcc showcontig sys.indexes2005 system table contains property information only for each index. sys.dm_db_index_usage_statsSystem view which records the access usage of every index in the database We can view the number of times this index has been used, the type of access and the last access date sys.dm_db_index_operational_statsSystem function which records the operational cost of access to the index We can view information such as the number of pages, locks, latches and waits. sys.objectsContains information on database objects sys.dm_db_missing_index_detailsSystem view which stores information on indexes the optimiser considers are missing. sys.dm_db_missing_index_group_statsSystem view which stores usage and access details for the missing indexes similar to sys.dm_db_index_usage_stats We can also view the improvement that the index is computed to make, this is essentially the same type of output as shown by the Tuning Advisor. sys.dm_db_missing_index_groupsPresumably this view will be of more use in SQL2008 sys.dm_db_missing_index_columnsA system function which returns the columns for a missing index Requires the index handle as a parameter © Colin Leversuch-Roberts Kelem Consulting Limited September 2007

sys.dm_db_index_usage_stats Tells us how the index is used Counts scans, seeks, lookups and writes Values are cumulative, so not so useful Contains last date of of each however 10 © Colin Leversuch-Roberts Kelem Consulting Limited September 2007

sys.dm_db_index_operational_stats Contains a wealth of information Page splits, waits, access at each index level Data is not maintained Not a view Need to snapshot the data © Colin Leversuch-Roberts Kelem Consulting Limited September

Some sample outputs © Colin Leversuch-Roberts Kelem Consulting Limited September 2007

sys.dm_db_index_physical_stats Actually a function Find the size of your index Use with care on large tables Sadly not table valued so difficult to join Roll your own © Colin Leversuch-Roberts Kelem Consulting Limited September

All about granularity Finding unused indexes Dealing with period end processes How often do I collect data and how much Little used indexes Seeks and lookups Making sense of it all 14 © Colin Leversuch-Roberts Kelem Consulting Limited September 2007

Index size A secondary index adds the clustered index Wide clustered indexes make for wide secondary indexes Wide indexes take space Wide indexes produce more io Wide indexes may be considered less cost effective by the optimiser © Colin Leversuch-Roberts Kelem Consulting Limited September

Missing Indexes Also available through the performance dashboard Lots of information Much as you receive from the DTA Simple query to extract basic information Don’t believe it all © Colin Leversuch-Roberts Kelem Consulting Limited September

And to finish Queries to check for duplicated indexes coming in part 5 on my blog Query / Report to show top indexes in cache Query / report to analyse plans in cache © Colin Leversuch-Roberts Kelem Consulting Limited September

More information Coming soon Available for consultancy 18 Thankyou for listening © Colin Leversuch-Roberts Kelem Consulting Limited September 2007