How Do Non-Clustered Indexes Improve Performance?

1,806 views
1,700 views

Published on

We've all heard the mantra about the importance of clustered indexes, but what about non-clustered indexes? Do you really need non-clustered indexes or are they just something that consultants recommend to increase their billable hours? In this session, we'll investigate the various flavors of non-clustered indexes and how they can be used to provide significant performance improvements.

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

  • Be the first to like this

No Downloads
Views
Total views
1,806
On SlideShare
0
From Embeds
0
Number of Embeds
976
Actions
Shares
0
Downloads
29
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

How Do Non-Clustered Indexes Improve Performance?

  1. 1. How Do Non-Clustered Indexes Improve Performance?
  2. 2. Introduction Jason Strate e: jstrate@pragmaticworks.com e: jasonstrate@gmail.com b: www.jasonstrate.com t: StrateSQL Resources jasonstrate.com/go/indexing MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  3. 3. About Pragmatic Works • • • • • • • Industry leaders in Microsoft BI and SQL Server Platform SQL Server Professionals - PASS Board of Directors, Speakers, Authors and MVP’s National Sales Team Divided by Microsoft Territories National System Integrator (NSI) Gold Certified in Business Intelligence and Data Platform Platform Modernization/Safe Passage Premier Partner for PDW SI Partner Program MS PDW Partner of Year FY13 Frontline Partnership Partner of the Year for Big Data Executive sponsor - Andy Mouacdie, WW sales director PDW • • Over 7,200 customers worldwide Over 186,000 people in PW database for demand generation MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  4. 4. Indexes
  5. 5. The “One” Path
  6. 6. Other Paths…
  7. 7. Agenda Introduction Just The Cluster Non-Clustered Index Patterns MAKING BUSINESS INTELLIGENT Value of NonClustered Summary www.pragmaticworks.com
  8. 8. Introduction Just The Cluster Value of NonClustered NonClustered Index Patterns Summary CLUSTERED INDEX OR HEAP MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  9. 9. Introduction Just The Cluster Value of NonClustered NonClustered Index Patterns Summary JUST THE CLUSTER MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  10. 10. Clustered • Default data storage • Sorted data storage – One or more columns – Data and index stored together • Fragmentation • Operations – Clustered index scan – Clustered index seek – Key Lookup
  11. 11. The Clustered Index Problem MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  12. 12. The Clustered Index Problem MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  13. 13. What About Non-Key Columns? MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  14. 14. What About Non-Key Columns? MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  15. 15. What About Non-Key Columns? MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  16. 16. Demo CLUSTERED INDEX PROBLEM MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  17. 17. Left searching for answers…
  18. 18. Got Problems? • Locks – Lock Escalation – Blocking – Deadlocking • Resource – CPU – Memory – Storage MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  19. 19. Introduction Just The Cluster Value of NonClustered NonClustered Index Patterns Summary VALUE OF NON-CLUSTERED MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  20. 20. • Sorted key values –One or more columns –Key values only –Pointers to Heap/Clustered Index rows • Secondary data access – Bridge to the data • Operations – Index scan – Index seek MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  21. 21. Additional Index Magic • Included Columns – Add data pages to index – Bring in the data pages! • Filtered Indexes – Reduce the index pages • Data Compression – Row/Page – Reduce the index pages MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  22. 22. The Non-Clustered MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  23. 23. What About Non-Key Columns? SELECT ProductID, OrderQty FROM Sales.SalesOrderheader WHERE ProductID = 776 MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  24. 24. What About Non-Key Columns? SELECT ProductID, OrderQty FROM Sales.SalesOrderheader WHERE ProductID = 716 MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  25. 25. What About Non-Key Columns? SELECT ProductID, OrderQty FROM Sales.SalesOrderheader WHERE ProductID = 762 MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  26. 26. Introduction Just The Cluster Value of NonClustered NonClustered Index Patterns Summary NON-CLUSTERED INDEX PATTERNS MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  27. 27. Non-Clustered Index Patterns Cover Up Team Up MAKING BUSINESS INTELLIGENT Look Up www.pragmaticworks.com
  28. 28. Non-Clustered Index Patterns Cover Up Team Up MAKING BUSINESS INTELLIGENT Look Up www.pragmaticworks.com
  29. 29. Non-Clustered Indexes - Cover Up CREATE INDEX IX_Sample ON Sales.SalesOrderheader (ProductID) MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  30. 30. Non-Clustered Indexes - Cover Up SELECT ProductID FROM Sales.SalesOrderheader WHERE ProductID = 776 MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  31. 31. Non-Clustered Indexes - Cover Up SELECT ProductID FROM Sales.SalesOrderheader MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  32. 32. Non-Clustered Indexes - Cover Up CREATE INDEX IX_Sample ON Sales.SalesOrderheader (ProductID ,OrderQty) MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  33. 33. Non-Clustered Indexes - Cover Up SELECT ProductID, OrderQty FROM Sales.SalesOrderheader WHERE ProductID = 716 MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  34. 34. Non-Clustered Indexes - Cover Up SELECT ProductID, OrderQty FROM Sales.SalesOrderheader MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  35. 35. Non-Clustered Index Patterns Cover Up Team Up MAKING BUSINESS INTELLIGENT Look Up www.pragmaticworks.com
  36. 36. Non-Clustered Indexes – Look Up CREATE INDEX IX_Sample ON Sales.SalesOrderheader (ProductID) MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  37. 37. Non-Clustered Indexes – Look Up SELECT ProductID, CarrierTrackingNumber FROM Sales.SalesOrderheader WHERE ProductID = 776 MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  38. 38. Non-Clustered Indexes – Look Up SELECT ProductID, CarrierTrackingNumber FROM Sales.SalesOrderheader WHERE ProductID = 776 MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  39. 39. Non-Clustered Index Patterns Cover Up Team Up MAKING BUSINESS INTELLIGENT Look Up www.pragmaticworks.com
  40. 40. Non-Clustered Indexes – Team Up CREATE INDEX IX_Sample ON Sales.SalesOrderheader (ProductID) MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  41. 41. Non-Clustered Indexes – Team Up CREATE INDEX IX_Sample ON Sales.SalesOrderheader (CarrierTrackingNumber) MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  42. 42. Non-Clustered Indexes – Team Up SELECT ProductID, CarrierTrackingNumber FROM Sales.SalesOrderheader WHERE ProductID = 776 AND CarrierTrackingNumber = ‘4911-403C-98’ MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  43. 43. Non-Clustered Indexes – Team Up SELECT ProductID, CarrierTrackingNumber FROM Sales.SalesOrderheader WHERE ProductID = 776 AND CarrierTrackingNumber = ‘4911-403C-98’ MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  44. 44. Demo NON-CLUSTERED INDEX PATTERN MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  45. 45. Introduction Just The Cluster Value of NonClustered NonClustered Index Patterns Summary SUMMARY MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  46. 46. Summary 1. Clustered indexes are not enough 2. Non-clustered indexes provide additional paths 3. Learn how to leverage all of the properties 4. Performance and stability enhanced through non-clustered indexes 5. Don’t go overboard… too much of a good thing MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  47. 47. Learn More About Indexes MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  48. 48. For more information… Name: Jason Strate Email: jstrate@pragmaticworks.com Blog: www.jasonstrate.com Resource: jasonstrate.com/go/indexing Products BI products to covert to a Microsoft BI platform and simplify development on the platform. Services Speed development through training, and rapid development services from Pragmatic Works. Foundation Helping those who do not have the means to get into information technology achieve their dreams.

×