+ All Categories
Home > Documents > The Art Of Indexing

The Art Of Indexing

Date post: 29-Aug-2014
Category:
Upload: kensimmons
View: 1,465 times
Download: 0 times
Share this document with a friend
Description:
 
29
The Art of Indexing Ken Simmons http://www.flickr.com/photos/h-k-d/2837128711/
Transcript
Page 1: The Art Of Indexing

The Art ofIndexing

Ken Simmons

http:

//w

ww

.flic

kr.c

om/p

hoto

s/h-

k-d/

2837

1287

11/

Page 2: The Art Of Indexing

Who is this guy?

DBADeveloperAuthorSQL Server MVPIT Industry for 10+ years

Page 3: The Art Of Indexing

ObjectivesIntroduce the different kinds of indexes and index options along with best practices for using them.Provide strategies for creating indexes by taking advantage of DMVs and the Plan Cache.Cover the various ways indexes can degrade performance along with options for finding and removing them.

Page 4: The Art Of Indexing

http://www.flickr.com/photos/pandora_6666/4686646577/

Page 5: The Art Of Indexing

http://www.flickr.com/photos/marsi/2208227079/

Page 6: The Art Of Indexing

The Boring Technical

Stuffhttp://www.flickr.com/photos/paraflyer/386529128/

Page 7: The Art Of Indexing

Types of Indexes

ClusteredNon ClusteredUniqueFilteredFull-TextSpatialXML

http://www.flickr.com/photos/leunix/518329490/

Page 8: The Art Of Indexing

Types of Indexes

ClusteredNon ClusteredUniqueFilteredFull-TextSpatialXML

http://www.flickr.com/photos/leunix/518329490/

Page 9: The Art Of Indexing

Types of Indexes

ClusteredNon ClusteredUniqueFilteredFull-TextSpatialXML

http://www.flickr.com/photos/leunix/518329490/

Page 10: The Art Of Indexing

Types of Indexes

ClusteredNon ClusteredUniqueFilteredFull-TextSpatialXML

http://www.flickr.com/photos/leunix/518329490/

Page 11: The Art Of Indexing

Regulations1 Clustered Index249 Non Clustered (2005)999 Non Clustered (2008)16 Columns or 900 Bytes

http://www.flickr.com/photos/slworking/2209152444/

Page 12: The Art Of Indexing

CharacteristicsClustered IndexNarrowUniqueStaticIncreasing

http://www.flickr.com/photos/braden71/4539323020/

Page 13: The Art Of Indexing

CharacteristicsClustered IndexNarrow

Less Data DuplicatedSmaller…

DatabasesBackupsMaintenance times

UniqueStaticIncreasing

http://www.flickr.com/photos/seibi/207579197/

Page 14: The Art Of Indexing

CharacteristicsClustered IndexNarrowUnique

Not Required4 Byte UniquifierNarrow Remember?

StaticIncreasing

http://www.flickr.com/photos/fazen/3778408/

Page 15: The Art Of Indexing

CharacteristicsClustered IndexNarrowUniqueStatic

Changes Cause… Additional Overhead for Non Clustered Indexes

Clustered Index Fragmentation

Increasinghttp://www.flickr.com/photos/st3f4n/4085958000/

Page 16: The Art Of Indexing

CharacteristicsClustered IndexNarrowUniqueStaticIncreasing

Data is added to the end of the Index

Reduces Page Splits and Fragmentation

http://www.flickr.com/photos/kevinkrejci/3065365140/

Page 17: The Art Of Indexing

CharacteristicsNon Clustered IndexCover Common QueriesLink to Clustered Index

Lookup

http://www.flickr.com/photos/dantaylor/1145628275/

Page 18: The Art Of Indexing

The Cool Stuff

http://www.flickr.com/photos/fpat/4242800364/

Page 19: The Art Of Indexing

Demo

http://www.flickr.com/photos/winterhalter/2883847843/

Page 20: The Art Of Indexing

SELECT http://www.flickr.com/photos/funky64/3485138671/

Page 21: The Art Of Indexing

http:

//w

ww

.flic

kr.c

om/p

hoto

s/kr

azyd

ad/6

0510

189

Page 22: The Art Of Indexing

What about the thousands of other queries that run on my server?

http://www.flickr.com/photos/mattwright/244358275/

Page 23: The Art Of Indexing

PerspectiveBetter

DMVs Provide a

Index UsageUnused IndexesExpensive To Maintain

Missing IndexesNo Query Information

Plan CacheQueryExecution PlanMissing Index Informationhttp://www.flickr.com/photos/danorbit/346563918/

Page 24: The Art Of Indexing

Demo

http://www.flickr.com/photos/winterhalter/2883847843/

Page 25: The Art Of Indexing

IntelligentMakeDecision

s

http://www.flickr.com/photos/belovedinc/4274873104/

Page 26: The Art Of Indexing

Demo

http://www.flickr.com/photos/winterhalter/2883847843/

Page 27: The Art Of Indexing

Review•Clustered Indexes•Unique, Narrow, Static, Increasing

•Non-Clustered Indexes•Cover Queries Not Covered By The Clustered Index•Use INCLUDE To Cover Non-Key Columns

•Use DMVs To Get A Better Perspective•Unused Indexes, Missing Indexes, Cached Plans

•Make Intelligent Decisions When Applying Indexes•Don’t Apply Indexes Based On Recommendations

Page 28: The Art Of Indexing

http:

//w

ww

.flic

kr.c

om/p

hoto

s/tr

avel

inlib

raria

n/22

3839

049/

Page 29: The Art Of Indexing

Contact InfoBlog

http://cybersql.blogspot.com/Email

[email protected] @KenSimmons

http://twitter.com/KenSimmonsLinkedIN

http://www.linkedin.com/in/kensimmons


Recommended