The Flavors of
Non-Clustered Indexes
Introduction
Jason
Strate

e: jstrate@pragmaticworks.com
e: jasonstrate@gmail.com
b: www.jasonstrate.com
t: StrateSQL

Res...
About Pragmatic Works

•
•
•
•
•
•
•

Industry leaders in Microsoft BI and SQL Server
Platform
SQL Server Professionals - ...
Caution

There will
be lots of
ice cream
pictures
Many Flavors
http://www.flickr.com/photos/rnljc/5334858173
http://www.flickr.com/photos/8566600@N07/2562797853
http://www.flickr.com/photos/amayu/5475537796
Non-Clustered Indexes
• Sorted key values
– One or more columns
– Key values only
– Pointers to Heap or
Clustered Index ro...
Agenda

Vanilla

Sundae

Neapolitan

Rocky Road

Sugar Cone

Gelato

MAKING BUSINESS INTELLIGENT

www.pragmaticworks.com
VANILLA

http://www.flickr.com/photos/cowbite/3452599539/
Single Column Index
• Provides a secondary path to data
• Allows alternative paths for finding data
• One column is stored...
Demo

SINGLE COLUMN

http://www.flickr.com/photos/cowbite/3452599539/
SUNDAE
Index Intersection
• Leverages multiple non-clustered indexes
• Filters on both indexes
• Returns the “intersection” of bo...
Demo

INDEX INTERSECTION
NEAPOLITAN
Multiple Column Index
• Two or more columns in the same index
• Index sorted from left to right
– Cannot skip columns to l...
Demo

MULTIPLE COLUMN
ROCKY ROAD

http://www.flickr.com/photos/stuart_spivack/2069689027/
Included Columns
•
•
•
•
•

Additional columns needed for queries
Typically data not included in index
Included columns br...
Demo

INCLUDED COLUMN

http://www.flickr.com/photos/stuart_spivack/2069689027/
SUGAR CONE
Filtered Indexes
• Add a WHERE clause to your index
• Changes the contents of the index
– Reduction in pages
– Reduction i...
Demo

FILTERED INDEXES
GELATO
Foreign Key Indexes
• All foreign keys should be indexed
– Not an index property

•
•
•
•

Constraint leverages sorts on v...
FOREIGN KEYS
SUMMARY

MAKING BUSINESS INTELLIGENT

www.pragmaticworks.com
Summary
•
•
•
•

You can get by on “vanilla” indexes
Indexes can vary in flavors
These flavors help improve your databases...
Learn More About Indexes

MAKING BUSINESS INTELLIGENT

www.pragmaticworks.com
For more information…
Name: Jason Strate
Email: jstrate@pragmaticworks.com

Blog: www.jasonstrate.com
Resource: jasonstrat...
Upcoming SlideShare
Loading in...5
×

The Flavors of Non-Clustered Indexes

485

Published on

A non-clustered index is just another way to get to data. Add in a couple columns and off you go. Not too much to think about, just fire and forget. But it’s not really that easy. Non-clustered indexes have a number of various ways in which they can be built and designed that can have significant impacts on performance. In this session we’ll look at what can go into a non-clustered index. We will explore what you can put into a non-clustered index and what you can expect back out from performance.

Published in: Technology, Sports
2 Comments
0 Likes
Statistics
Notes
  • Be the first to like this

No Downloads
Views
Total Views
485
On Slideshare
0
From Embeds
0
Number of Embeds
12
Actions
Shares
0
Downloads
11
Comments
2
Likes
0
Embeds 0
No embeds

No notes for slide

The Flavors of Non-Clustered Indexes

  1. 1. The Flavors of Non-Clustered Indexes
  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. Caution There will be lots of ice cream pictures
  5. 5. Many Flavors
  6. 6. http://www.flickr.com/photos/rnljc/5334858173
  7. 7. http://www.flickr.com/photos/8566600@N07/2562797853
  8. 8. http://www.flickr.com/photos/amayu/5475537796
  9. 9. Non-Clustered Indexes • Sorted key values – One or more columns – Key values only – Pointers to Heap or Clustered Index rows – Non-LOB data • Secondary data access – Bridge to the data • Operations – Index scan – Index seek MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  10. 10. Agenda Vanilla Sundae Neapolitan Rocky Road Sugar Cone Gelato MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  11. 11. VANILLA http://www.flickr.com/photos/cowbite/3452599539/
  12. 12. Single Column Index • Provides a secondary path to data • Allows alternative paths for finding data • One column is stored outside table – Data is sorted by key – Includes clustered index keys • Focus on most used columns for filters • Do not index every column MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  13. 13. Demo SINGLE COLUMN http://www.flickr.com/photos/cowbite/3452599539/
  14. 14. SUNDAE
  15. 15. Index Intersection • Leverages multiple non-clustered indexes • Filters on both indexes • Returns the “intersection” of both indexes Index 1 Index 2 MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  16. 16. Demo INDEX INTERSECTION
  17. 17. NEAPOLITAN
  18. 18. Multiple Column Index • Two or more columns in the same index • Index sorted from left to right – Cannot skip columns to leverage sort • Cover filters over multiple columns – Or cover non-filtered columns • Reduces number of indexes needed MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  19. 19. Demo MULTIPLE COLUMN
  20. 20. ROCKY ROAD http://www.flickr.com/photos/stuart_spivack/2069689027/
  21. 21. Included Columns • • • • • Additional columns needed for queries Typically data not included in index Included columns brings in data pages Store specific columns unsorted with index Don’t included all columns – Or even most • Be cautious of update rate of data MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  22. 22. Demo INCLUDED COLUMN http://www.flickr.com/photos/stuart_spivack/2069689027/
  23. 23. SUGAR CONE
  24. 24. Filtered Indexes • Add a WHERE clause to your index • Changes the contents of the index – Reduction in pages – Reduction in size – Lessen impact of index scan • Unmatched Index warning MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  25. 25. Demo FILTERED INDEXES
  26. 26. GELATO
  27. 27. Foreign Key Indexes • All foreign keys should be indexed – Not an index property • • • • Constraint leverages sorts on validation Can reduce locking, blocking, and deadlocks Common problem in many systems Silent killer of the database MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  28. 28. FOREIGN KEYS
  29. 29. SUMMARY MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  30. 30. Summary • • • • You can get by on “vanilla” indexes Indexes can vary in flavors These flavors help improve your databases Filtered indexes, included columns, and multiple columns MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  31. 31. Learn More About Indexes MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  32. 32. 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.
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×