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.
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
11. 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
12. The Clustered Index Problem
MAKING BUSINESS INTELLIGENT
www.pragmaticworks.com
13. The Clustered Index Problem
MAKING BUSINESS INTELLIGENT
www.pragmaticworks.com
14. What About Non-Key Columns?
MAKING BUSINESS INTELLIGENT
www.pragmaticworks.com
15. What About Non-Key Columns?
MAKING BUSINESS INTELLIGENT
www.pragmaticworks.com
16. What About Non-Key Columns?
MAKING BUSINESS INTELLIGENT
www.pragmaticworks.com
21. ⢠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
22. 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
24. What About Non-Key Columns?
SELECT ProductID, OrderQty
FROM Sales.SalesOrderheader
WHERE ProductID = 776
MAKING BUSINESS INTELLIGENT
www.pragmaticworks.com
25. What About Non-Key Columns?
SELECT ProductID, OrderQty
FROM Sales.SalesOrderheader
WHERE ProductID = 716
MAKING BUSINESS INTELLIGENT
www.pragmaticworks.com
26. What About Non-Key Columns?
SELECT ProductID, OrderQty
FROM Sales.SalesOrderheader
WHERE ProductID = 762
MAKING BUSINESS INTELLIGENT
www.pragmaticworks.com
30. Non-Clustered Indexes - Cover Up
CREATE INDEX IX_Sample ON
Sales.SalesOrderheader (ProductID)
MAKING BUSINESS INTELLIGENT
www.pragmaticworks.com
31. Non-Clustered Indexes - Cover Up
SELECT ProductID
FROM Sales.SalesOrderheader
WHERE ProductID = 776
MAKING BUSINESS INTELLIGENT
www.pragmaticworks.com
32. Non-Clustered Indexes - Cover Up
SELECT ProductID
FROM Sales.SalesOrderheader
MAKING BUSINESS INTELLIGENT
www.pragmaticworks.com
33. Non-Clustered Indexes - Cover Up
CREATE INDEX IX_Sample ON
Sales.SalesOrderheader (ProductID
,OrderQty)
MAKING BUSINESS INTELLIGENT
www.pragmaticworks.com
34. Non-Clustered Indexes - Cover Up
SELECT ProductID, OrderQty
FROM Sales.SalesOrderheader
WHERE ProductID = 716
MAKING BUSINESS INTELLIGENT
www.pragmaticworks.com
35. Non-Clustered Indexes - Cover Up
SELECT ProductID, OrderQty
FROM Sales.SalesOrderheader
MAKING BUSINESS INTELLIGENT
www.pragmaticworks.com
37. Non-Clustered Indexes â Look Up
CREATE INDEX IX_Sample ON
Sales.SalesOrderheader (ProductID)
MAKING BUSINESS INTELLIGENT
www.pragmaticworks.com
38. Non-Clustered Indexes â Look Up
SELECT ProductID, CarrierTrackingNumber
FROM Sales.SalesOrderheader
WHERE ProductID = 776
MAKING BUSINESS INTELLIGENT
www.pragmaticworks.com
39. Non-Clustered Indexes â Look Up
SELECT ProductID, CarrierTrackingNumber
FROM Sales.SalesOrderheader
WHERE ProductID = 776
MAKING BUSINESS INTELLIGENT
www.pragmaticworks.com
41. Non-Clustered Indexes â Team Up
CREATE INDEX IX_Sample ON
Sales.SalesOrderheader (ProductID)
MAKING BUSINESS INTELLIGENT
www.pragmaticworks.com
42. Non-Clustered Indexes â Team Up
CREATE INDEX IX_Sample ON
Sales.SalesOrderheader
(CarrierTrackingNumber)
MAKING BUSINESS INTELLIGENT
www.pragmaticworks.com
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. 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
47. 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
48. Learn More About Indexes
MAKING BUSINESS INTELLIGENT
www.pragmaticworks.com
49. 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.