how do non-clustered indexes improve performance?
DESCRIPTION
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.TRANSCRIPT
![Page 1: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/1.jpg)
How Do Non-Clustered Indexes Improve Performance?
![Page 2: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/2.jpg)
Jason Strate
b: www.jasonstrate.com
t: StrateSQL
Resources jasonstrate.com/go/indexing
Introduction
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
![Page 3: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/3.jpg)
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
• 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 FY13Frontline Partnership Partner of the Year for Big DataExecutive sponsor - Andy Mouacdie, WW sales director PDW
• Over 7,200 customers worldwide• Over 186,000 people in PW database for demand
generation
About Pragmatic Works
![Page 4: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/4.jpg)
Indexes
![Page 5: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/5.jpg)
The “One” Path
![Page 6: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/6.jpg)
Other Paths…
![Page 7: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/7.jpg)
![Page 8: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/8.jpg)
Agenda
Introduction Just The Cluster
Value of Non-Clustered
Non-Clustered Index Patterns
Summary
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
![Page 9: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/9.jpg)
CLUSTERED INDEX OR HEAP
IntroductionJust The Cluster
Value of Non-
Clustered
Non-Clustered
Index Patterns
Summary
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
![Page 10: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/10.jpg)
JUST THE CLUSTER
IntroductionJust The Cluster
Value of Non-
Clustered
Non-Clustered
Index Patterns
Summary
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
![Page 11: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/11.jpg)
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
![Page 12: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/12.jpg)
The Clustered Index Problem
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
![Page 13: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/13.jpg)
The Clustered Index Problem
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
![Page 14: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/14.jpg)
What About Non-Key Columns?
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
![Page 15: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/15.jpg)
What About Non-Key Columns?
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
![Page 16: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/16.jpg)
What About Non-Key Columns?
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
![Page 17: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/17.jpg)
CLUSTERED INDEX PROBLEMDemo
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
![Page 18: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/18.jpg)
Left searching for answers…
![Page 19: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/19.jpg)
Got Problems?
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
• Locks
– Lock Escalation
– Blocking
– Deadlocking
• Resource
– CPU
– Memory
– Storage
![Page 20: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/20.jpg)
VALUE OF NON-CLUSTERED
IntroductionJust The Cluster
Value of Non-
Clustered
Non-Clustered
Index Patterns
Summary
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
![Page 21: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/21.jpg)
• Sorted key values–One or more columns
–Key values only
–Pointers to Heap/ClusteredIndex rows
• Secondary data access– Bridge to the data
• Operations– Index scan– Index seek
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
![Page 22: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/22.jpg)
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
![Page 23: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/23.jpg)
The Non-Clustered
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
![Page 24: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/24.jpg)
What About Non-Key Columns?
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
SELECT ProductID, OrderQty
FROM Sales.SalesOrderheader
WHERE ProductID = 776
![Page 25: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/25.jpg)
What About Non-Key Columns?
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
SELECT ProductID, OrderQty
FROM Sales.SalesOrderheader
WHERE ProductID = 716
![Page 26: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/26.jpg)
What About Non-Key Columns?
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
SELECT ProductID, OrderQty
FROM Sales.SalesOrderheader
WHERE ProductID = 762
![Page 27: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/27.jpg)
NON-CLUSTERED INDEX PATTERNS
IntroductionJust The Cluster
Value of Non-
Clustered
Non-Clustered
Index Patterns
Summary
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
![Page 28: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/28.jpg)
Non-Clustered Index Patterns
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
Cover Up
Look Up
Team Up
![Page 29: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/29.jpg)
Non-Clustered Index Patterns
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
Cover Up
Look Up
Team Up
![Page 30: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/30.jpg)
Non-Clustered Indexes - Cover Up
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
CREATE INDEX IX_Sample ON
Sales.SalesOrderheader (ProductID)
![Page 31: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/31.jpg)
Non-Clustered Indexes - Cover Up
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
SELECT ProductID
FROM Sales.SalesOrderheader
WHERE ProductID = 776
![Page 32: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/32.jpg)
Non-Clustered Indexes - Cover Up
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
SELECT ProductID
FROM Sales.SalesOrderheader
![Page 33: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/33.jpg)
Non-Clustered Indexes - Cover Up
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
CREATE INDEX IX_Sample ON
Sales.SalesOrderheader (ProductID
,OrderQty)
![Page 34: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/34.jpg)
Non-Clustered Indexes - Cover Up
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
SELECT ProductID, OrderQty
FROM Sales.SalesOrderheader
WHERE ProductID = 716
![Page 35: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/35.jpg)
Non-Clustered Indexes - Cover Up
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
SELECT ProductID, OrderQty
FROM Sales.SalesOrderheader
![Page 36: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/36.jpg)
Non-Clustered Index Patterns
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
Cover Up
Look Up
Team Up
![Page 37: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/37.jpg)
Non-Clustered Indexes – Look Up
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
CREATE INDEX IX_Sample ON
Sales.SalesOrderheader (ProductID)
![Page 38: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/38.jpg)
Non-Clustered Indexes – Look Up
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
SELECT ProductID, CarrierTrackingNumber
FROM Sales.SalesOrderheader
WHERE ProductID = 776
![Page 39: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/39.jpg)
Non-Clustered Indexes – Look Up
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
SELECT ProductID, CarrierTrackingNumber
FROM Sales.SalesOrderheader
WHERE ProductID = 776
![Page 40: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/40.jpg)
Non-Clustered Index Patterns
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
Cover Up
Look Up
Team Up
![Page 41: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/41.jpg)
Non-Clustered Indexes – Team Up
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
CREATE INDEX IX_Sample ON
Sales.SalesOrderheader (ProductID)
![Page 42: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/42.jpg)
Non-Clustered Indexes – Team Up
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
CREATE INDEX IX_Sample ON
Sales.SalesOrderheader
(CarrierTrackingNumber)
![Page 43: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/43.jpg)
Non-Clustered Indexes – Team Up
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
SELECT ProductID, CarrierTrackingNumber
FROM Sales.SalesOrderheader
WHERE ProductID = 776
AND CarrierTrackingNumber = ‘4911-403C-98’
![Page 44: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/44.jpg)
Non-Clustered Indexes – Team Up
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
SELECT ProductID, CarrierTrackingNumber
FROM Sales.SalesOrderheader
WHERE ProductID = 776
AND CarrierTrackingNumber = ‘4911-403C-98’
![Page 45: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/45.jpg)
NON-CLUSTERED INDEX PATTERNDemo
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
![Page 46: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/46.jpg)
SUMMARY
IntroductionJust The Cluster
Value of Non-
Clustered
Non-Clustered
Index Patterns
Summary
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
![Page 47: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/47.jpg)
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
![Page 48: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/48.jpg)
Learn More About Indexes
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
![Page 49: How Do Non-Clustered Indexes Improve Performance?](https://reader035.vdocuments.mx/reader035/viewer/2022062514/5580f008d8b42aec5a8b53b5/html5/thumbnails/49.jpg)
ServicesSpeed development through training, and rapid development services from Pragmatic Works.
ProductsBI products to covert to a Microsoft BI platform and simplify development onthe platform.
FoundationHelping those who do not have themeans to get into information technologyachieve their dreams.
For more information…
Name: Jason Strate
Email: [email protected]
Blog: www.jasonstrate.com
Resource: jasonstrate.com/go/indexing