Your SlideShare is downloading. ×
0
5 ways to improve performance through indexing
5 ways to improve performance through indexing
5 ways to improve performance through indexing
5 ways to improve performance through indexing
5 ways to improve performance through indexing
5 ways to improve performance through indexing
5 ways to improve performance through indexing
5 ways to improve performance through indexing
5 ways to improve performance through indexing
5 ways to improve performance through indexing
5 ways to improve performance through indexing
5 ways to improve performance through indexing
5 ways to improve performance through indexing
5 ways to improve performance through indexing
5 ways to improve performance through indexing
5 ways to improve performance through indexing
5 ways to improve performance through indexing
5 ways to improve performance through indexing
5 ways to improve performance through indexing
5 ways to improve performance through indexing
5 ways to improve performance through indexing
5 ways to improve performance through indexing
5 ways to improve performance through indexing
5 ways to improve performance through indexing
5 ways to improve performance through indexing
5 ways to improve performance through indexing
5 ways to improve performance through indexing
5 ways to improve performance through indexing
5 ways to improve performance through indexing
5 ways to improve performance through indexing
5 ways to improve performance through indexing
5 ways to improve performance through indexing
5 ways to improve performance through indexing
5 ways to improve performance through indexing
5 ways to improve performance through indexing
5 ways to improve performance through indexing
5 ways to improve performance through indexing
5 ways to improve performance through indexing
5 ways to improve performance through indexing
5 ways to improve performance through indexing
5 ways to improve performance through indexing
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

5 ways to improve performance through indexing

800

Published on

Published in: Technology, Business
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
800
On Slideshare
0
From Embeds
0
Number of Embeds
12
Actions
Shares
0
Downloads
30
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. 5 Ways to Improve Performance through Indexing
  • 2. Jason Strate e: jstrate@pragmaticworks.com e: jasonstrate@gmail.com b: www.jasonstrate.com t: StrateSQL Resources jasonstrate.com/go/indexing Introduction MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 3. MAKING BUSINESS INTELLIGENT www.pragmaticworks.com • Founded 2008 by MSFT MVP Brian Knight • Focused on the MSFT SQL Server Platform • Provides services, training and software • MSFT/HP “go to” partner: • Gold Certified: o BI o Data Management o SQL Performance • Team led by multiple MVP’s • Offices throughout the US with Corporate HQ in Jacksonville, FL Pragmatic Works Company History
  • 4. Indexes
  • 5. Disappointment
  • 6. 5 Ways to Improve Performance through Indexing
  • 7. Lookup Imbalance
  • 8. Lookup Imbalance • Excessive key lookups – Exceed number of seeks • Problems – Increased CPU – Increased IO – Increased duration MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 9. Possible Solutions • Ignore the problem – Choose high key lookup rate • Move clustered index – Maybe the key is wrong • Add included columns – Improve NC indexes MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 10. Case Study 1 • What’s wrong? • Do you see the pattern? • What do you do? – Move clustered index MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 11. Case Study 2 • What’s wrong? • Do you see the pattern? • What do you do? – Move clustered index – Add included columns MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 12. Case Study 3 • What’s wrong? • Do you see the pattern? • What do you do? – Add included columns MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 13. November 6-9, Seattle, WA Lookup Imbalance • Demo MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 14. Lookup Imbalance Summary • Key lookups should not exceed seeks • Investigate “WHY” when they do • Consider whether to: – Move the clustered index – Add included columns to non-clustered indexes • Usage patterns will shift over time MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 15. Scan Heavy Indexes
  • 16. Scan Heavy Indexes • High scans on large indexes – Exceed seeks • Problems – Increased IO – Increased locking • Potential deadlocks – Affect page life expectancy – Impact memory distribution MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 17. Case Study 1 • Metric is high, so what? • How do you tie into performance counter? – Sys.dm_db_index_usage_stats – Plan cache MAKING BUSINESS INTELLIGENT www.pragmaticworks.com Access Methods:Full Scans/sec
  • 18. Case Study 2 • What’s wrong? • Why aren’t the other indexes used? • Are the right indexes in place? • What do you do? – Examine execution plans – Add in correct indexes MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 19. November 6-9, Seattle, WA Scan Heavy Indexes • Demo MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 20. Scan Heavy Indexes Summary • High scans on indexes can impact performance – Higher IO – More locking • More Blocking • Possible Deadlocking – Memory impacted • Find the occurrences – Identify indexes and analyze plans – Add alternative indexes MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 21. Filtered Indexes
  • 22. Filtered Indexes • Index with a WHERE clause – Only includes filtered rows – Decreases rows in index • Effect – Improved plan quality – Improved storage – Lower build time – Less maintenance • Benefit – Scan of small set of data MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 23. Case Study • New data coming this week – Represents < 1% of rows • Can’t rebuild indexes – Statistics on new rows inaccurate • Need high quality plans – Indexes in place aren’t used • What do you do? MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 24. Filtered Index Issue • Filter Criteria – Must be included – Can not be parameterized • Plan warning – Unmatched indexes MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 25. November 6-9, Seattle, WA Filtered Indexes • Demo MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 26. Filtered Index Summary • Consider filtered indexes for: – Large indexes with limited range of use – Tables with large number of new rows • Improves index performance – Smaller, lightweight, agile – Improved plan quality • Seeks over scans (small data over large data) • Scans over seeks (tiny data over small data) MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 27. Missing Indexes
  • 28. Missing Indexes • Optimize through materialization – Index versus statistics • Three options – Dynamic management views – Database Engine Tuning Advisor – Plan Cache MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 29. Missing Indexes MAKING BUSINESS INTELLIGENT www.pragmaticworks.com MISSING INDEXES!!!
  • 30. November 6-9, Seattle, WA Missing Indexes • Demo MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 31. Missing Index Summary • These are FREE recommendations – Results of actual performance opportunities – Provide opportunity to focus on other needs • These are recommendations – Index schema to ensure value – Consolidate when possible – Review associated queries MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 32. Foreign Key Indexes
  • 33. Indexing Foreign Keys • Foreign keys enforcement – INSERT – UPDATE – DELETE • Performed in background • Unseen until a problem MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 34. Indexing Foreign Key Issues • Unindexed foreign key – Constraint columns • Performance issues – Scan of column values – Increased locking – Blocking likely – Potential deadlocking MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 35. Case Study Delete from SalesOrderHeader? MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 36. Case Study Delete from SalesOrderDetail? MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 37. Case Study Delete from SalesOrderHeaderSaleReason? MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 38. November 6-9, Seattle, WA Indexing Foreign Keys • Demo MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 39. Indexing Foreign Key Summary • Foreign keys are important – Enforce integrity of data – Constraints on values • Operations occur in background – DELETEs often source of issues – Can lead to deadlocks MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 40. Learn More About Indexes MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 41. Services Speed development through training, and rapid development services from Pragmatic Works. Products BI products to covert to a Microsoft BI platform and simplify development on the platform. Foundation Helping those who do not have the means to get into information technology achieve their dreams. For more information… Name: Jason Strate Email: jstrate@pragmaticworks.com Blog: www.jasonstrate.com Resource: jasonstrate.com/go/indexing

×