It's the age old question, do I put a clustered index on the table or leave it as a heap? While a simple question, this can have serious impacts on the performance of the table in queries. In this session, we'll review the basics of both clustered indexes and heaps; identifying key differences and cases where you might choose one over another.
3. 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 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
About Pragmatic Works
8. Agenda
Introduction The Heap Clustered Index
Index Patterns Summary
MAKING BUSINESS INTELLIGENT
www.pragmaticworks.com
9. Session Goals
• Define differences between
heaps and clustered indexes
• Explain design considerations
• Demonstrate differences
between key column choices
MAKING BUSINESS INTELLIGENT
www.pragmaticworks.com
10. THE HEAP
Introduction The Heap
Clustered
Index
Index
Patterns
Summary
MAKING BUSINESS INTELLIGENT
www.pragmaticworks.com
11. Heap Structure
• Pile of data
– Unordered
– First in, first out
– Scan “happy”
• Table Scan Access
• Forwarded Records
MAKING BUSINESS INTELLIGENT
www.pragmaticworks.com
16. Clustered Index
• Mechanism for storing data
– Logically ordered
– Structured
– Accessible
– Direct path
MAKING BUSINESS INTELLIGENT
www.pragmaticworks.com
37. Identity Column
• Non-related value that defines each row
uniquely
• Assigned when data is inserted
• Typically uses:
– Int or bigint
– IDENTITY or SEQUENCE
– Uniqueidentifier
MAKING BUSINESS INTELLIGENT
www.pragmaticworks.com
39. Surrogate Key
• Unique value is a part of the row
• Assigned in the source data
• Data type dependent on the data
• Value should be unchanging
– Employee ID
– Social Security Number
– Birthdate
MAKING BUSINESS INTELLIGENT
www.pragmaticworks.com
41. Foreign Key
• One-to-many relationships
• Access path in child via parent
• Piggy-backs identity pattern
– Parent left of child identity value
• Common in many applications
– Order header to details
– Hotels to rooms
MAKING BUSINESS INTELLIGENT
www.pragmaticworks.com
43. Multi-Column
• Similar to foreign key pattern
• Many-to-many relationships
• Highly dependent on selectivity
• NOT a collection of dimension keys
MAKING BUSINESS INTELLIGENT
www.pragmaticworks.com
48. Summary
• Clustered indexes are important
• Select clustering keys based on need
• Validate clustered indexes over time
MAKING BUSINESS INTELLIGENT
www.pragmaticworks.com
49. More Information
Expert Performance Indexing
For SQL Server 2012
Jason Strate
Ted Krueger
Overview
Statistics
Maintenance
Tools
Analysis
http://amzn.com/1430237414
MAKING BUSINESS INTELLIGENT
www.pragmaticworks.com
50. Services
Speed development through training, and
rapid development services from
Pragmatic Works.
Products
BI products to covert to a Microsoft BI
platform and simplify development on
the platform.
Foundation
Helping those who do not have the
means to get into information technology
achieve their dreams.
For more information…
Name: Jason Strate
Email: jstrate@pragmaticworks.com
Blog: www.jasonstrate.com
Resource: jasonstrate.com/go/indexing
Need Help? jasonstrate.com/go/vmdba