There are many "best practices" around that help people decide how to index databases. Having these practices can help alleviate the time that it takes to design an indexing strategy for a database. These practices can be of great use, except when they are wrong. Join us in this session, as we discuss some common myths associated with indexes and then dive into the myths to demonstrate how they can be debunked. At the end of the session, you'll know a few more things about indexes and leave armed with scripts that can help you debunk these myths on your own.
http://pragmaticworks.com/LearningCenter/FreeTrainingWebinars/PastWebinars.aspx?ResourceId=654
7. INTELLIGENT DATA SOLUTIONS WWW.PRAGMATICWORKS.COM7
Primary Keys Are Always Clustered
Primary keys are clustered by default
Common point of confusion
Often the desired behavior
Is the primary key a good clustered index?
Static and stable
Ever increasing
10. INTELLIGENT DATA SOLUTIONS WWW.PRAGMATICWORKS.COM10
Index Column Order Doesn’t Matter
Using and seeking an index are not the same
Read execution plans carefully
Validate scans versus seeks
Indexes are sorted left to right
All columns are not required
Scans aren’t necessarily bad
11. INTELLIGENT DATA SOLUTIONS WWW.PRAGMATICWORKS.COM11
Index Column Order Doesn’t Matter
Col1 Col2
A 1
A 2
A 3
B 1
B 2
B 3
C 1
C 2
C 3
A 1
14. INTELLIGENT DATA SOLUTIONS WWW.PRAGMATICWORKS.COM14
Clustered Indexes Are Physically Ordered
Clustered indexes sort data within the index
Accurately find specific values
A before B, B before C
Physical sorted at the tree level
Path data access directly to the required page
Logically sorted at the page level
Minimize page rewrites on DML
17. INTELLIGENT DATA SOLUTIONS WWW.PRAGMATICWORKS.COM17
Fill Factor Affects Insert Operations
Fill factor leaves space on data pages
Why do we do this?
Leave space for DML operations
Mitigate page splits during DML operations
Provides a buffer for data variability
22. INTELLIGENT DATA SOLUTIONS WWW.PRAGMATICWORKS.COM22
Every Table Should Have a XXX Index
Blanket statements suck
Doesn’t account for all situations
Or even most situations
Not 50/50
Not 90/10
Is there a safe answer?
23. INTELLIGENT DATA SOLUTIONS WWW.PRAGMATICWORKS.COM23
Heap / Clustered Indexes
Heap
• Non-selective access
• Bulk Loaded tables
• Fragmentation prone
with high inserts
• Staging tables
Clustered Index
• Highly modified data
• Singleton access
• Range scans
• Key ordered results
25. Products
Improve the quality,
productivity, and performance
of your SQL Server and BI
solutions.
Services
Speed development through
training and rapid
development services from
Pragmatic Works.
Foundation
Helping those who don’t have
the means to get into
information technology and to
achieve their dreams.
Name: Jason Strate
Email: jstrate@pragmaticworks.com
Blog: www.jasonstrate.com
Resource: www.jasonstrate.com/go/indexing
Need Help? jasonstrate.com/go/vmdba