SlideShare une entreprise Scribd logo
1  sur  42
Advanced Index Tuning
Brent Ozar SQL Server MVPfor Quest Software SQLServerPedia Ed. SQL, SAN, VM admin Dot-com-crash experience Performance freak Twitter @BrentO Blog: www.BrentOzar.com Photo Source http://www.flickr.com/photos/vasta/415625308/
Today’s Agenda Passive Tuning Active Tuning Index Compression The Silent Killer Resources and Q&A
Passive Tuning with DMVs
DMV Tuning Lifecycle
Removing Indexes
Results
Why Are Writes Different?
Our Table: Items
Indexes On An “Item” Table Index #1: UPC_Code Index #2: SupplierID Index #3: Category QtyInStock Photo licensed with Creative Commons from:http://www.flickr.com/photos/revolute/1944742197/
Data In The Index
But When It Changes…
That’s Why…
Our Query
A Better Way: Includes CREATE INDEX  IX_Category_Includes   ON dbo.Items (Category)   INCLUDE (QtyInStock)
And When It Changes…
Query Plan
Remember, Never SELECT *
Leave a Bread Crumb Trail
DMV Tuning Lifecycle
Missing Index Query
Okay – Now What?
When Do We Add Indexes?
DMV Tuning Lifecycle
Active Tuning: The Wizards
Danger! Danger!
The End Result CREATE NONCLUSTERED INDEX [_dta_index_Activity_11_1977058079__K1_K4_K7_K5_K3] ON [dbo].[Activity]  ( 	[ServerName] ASC, 	[ActivityTypeID] ASC, 	[StatusTypeID] ASC, 	[StartTime] ASC, 	[DatabaseID] ASC )
Rename Each Index CREATE NONCLUSTERED INDEX [IX_ServerName_ActivityTypeID_StatusTypeID_StartTime_DatabaseID] ON [dbo].[Activity]  ( 	[ServerName] ASC, 	[ActivityTypeID] ASC, 	[StatusTypeID] ASC, 	[StartTime] ASC, 	[DatabaseID] ASC ) ON [PRIMARY]
Makes Ongoing Tuning Easier
Active Tuning Summary Don’t just click apply Use smart names Look for overlaps Go passive first
SQL 2008 Data Compression
Estimating Compression sp_estimate_data_compression_savings @schema_name @object_name @index_id @partition_number @data_compression
Index Compression Drawbacks Enterprise Edition only No inheritance No automation
The Silent Performance Killer
Pretend You’re SQL Server Photo Licensed with Creative Commons From http://www.flickr.com/photos/quacktaculous/3143079032/
13% to 460%Faster
Absolutely No: App changes Vendor issues Testing required Guessing on indexes Backfires
Not All Unicorns and Roses Standard Edition: Offline Only Enterprise Edition: Most Online Generates a lot of transaction logs
The Native Solution
The Better Way: T-SQL Code
Don’t Reinvent The Wheel
http://www.brentozar.com/go/faster

Contenu connexe

Similaire à Advanced Index Tuning for SQL Server

Growing in the wild. The story by cubrid database developers (Esen Sagynov, E...
Growing in the wild. The story by cubrid database developers (Esen Sagynov, E...Growing in the wild. The story by cubrid database developers (Esen Sagynov, E...
Growing in the wild. The story by cubrid database developers (Esen Sagynov, E...
Ontico
 
It Launch Plan
It Launch PlanIt Launch Plan
It Launch Plan
tcaesar
 
Providers
ProvidersProviders
Providers
BeMyApp
 

Similaire à Advanced Index Tuning for SQL Server (20)

Prospectus editing at the University of Bristol- an overview:TERMINALFOUR t44...
Prospectus editing at the University of Bristol- an overview:TERMINALFOUR t44...Prospectus editing at the University of Bristol- an overview:TERMINALFOUR t44...
Prospectus editing at the University of Bristol- an overview:TERMINALFOUR t44...
 
WORKSHOP: Microservices as Containers on AWS
WORKSHOP: Microservices as Containers on AWSWORKSHOP: Microservices as Containers on AWS
WORKSHOP: Microservices as Containers on AWS
 
tSQLt Database Unit Testing
tSQLt Database Unit TestingtSQLt Database Unit Testing
tSQLt Database Unit Testing
 
Growing in the wild. The story by cubrid database developers (Esen Sagynov, E...
Growing in the wild. The story by cubrid database developers (Esen Sagynov, E...Growing in the wild. The story by cubrid database developers (Esen Sagynov, E...
Growing in the wild. The story by cubrid database developers (Esen Sagynov, E...
 
Growing in the Wild. The story by CUBRID Database Developers.
Growing in the Wild. The story by CUBRID Database Developers.Growing in the Wild. The story by CUBRID Database Developers.
Growing in the Wild. The story by CUBRID Database Developers.
 
Baking Stash in the AWS Cloud at Netflix
Baking Stash in the AWS Cloud at NetflixBaking Stash in the AWS Cloud at Netflix
Baking Stash in the AWS Cloud at Netflix
 
Serverless SQL
Serverless SQLServerless SQL
Serverless SQL
 
Professional Services Insights into Improving Sitecore XP
Professional Services Insights into Improving Sitecore XPProfessional Services Insights into Improving Sitecore XP
Professional Services Insights into Improving Sitecore XP
 
It Launch Plan
It Launch PlanIt Launch Plan
It Launch Plan
 
Performance Stability, Tips and Tricks and Underscores
Performance Stability, Tips and Tricks and UnderscoresPerformance Stability, Tips and Tricks and Underscores
Performance Stability, Tips and Tricks and Underscores
 
How to Build a Metrics-optimized Software Delivery Pipeline
How to Build a Metrics-optimized Software Delivery PipelineHow to Build a Metrics-optimized Software Delivery Pipeline
How to Build a Metrics-optimized Software Delivery Pipeline
 
Future career goals in it
Future career goals in itFuture career goals in it
Future career goals in it
 
Spring batch for large enterprises operations
Spring batch for large enterprises operations Spring batch for large enterprises operations
Spring batch for large enterprises operations
 
TheTricky Bits of Deployment Automation
TheTricky Bits of Deployment Automation TheTricky Bits of Deployment Automation
TheTricky Bits of Deployment Automation
 
Azure functions
Azure functionsAzure functions
Azure functions
 
DevOps > CI + CD. A web developer's introduction to Application Insights
DevOps > CI + CD.  A web developer's introduction to Application InsightsDevOps > CI + CD.  A web developer's introduction to Application Insights
DevOps > CI + CD. A web developer's introduction to Application Insights
 
DevOps: Find Solutions, Not More Defects
DevOps: Find Solutions, Not More DefectsDevOps: Find Solutions, Not More Defects
DevOps: Find Solutions, Not More Defects
 
Providers
ProvidersProviders
Providers
 
JavaCro'15 - Web UI best practice integration with Java EE 7 - Peter Lehto
JavaCro'15 - Web UI best practice integration with Java EE 7 - Peter LehtoJavaCro'15 - Web UI best practice integration with Java EE 7 - Peter Lehto
JavaCro'15 - Web UI best practice integration with Java EE 7 - Peter Lehto
 
HTML5.pptx
HTML5.pptxHTML5.pptx
HTML5.pptx
 

Plus de Quest Software (10)

Virtualization and SAN Basics for DBAs
Virtualization and SAN Basics for DBAsVirtualization and SAN Basics for DBAs
Virtualization and SAN Basics for DBAs
 
Perfmon And Profiler 201
Perfmon And Profiler 201Perfmon And Profiler 201
Perfmon And Profiler 201
 
SQL Server On SANs
SQL Server On SANsSQL Server On SANs
SQL Server On SANs
 
Perfmon And Profiler 101
Perfmon And Profiler 101Perfmon And Profiler 101
Perfmon And Profiler 101
 
Disaster Recovery 101
Disaster Recovery 101Disaster Recovery 101
Disaster Recovery 101
 
CMDB Basics
CMDB BasicsCMDB Basics
CMDB Basics
 
How To Write A SQL Server Performance Review
How To Write A SQL Server Performance ReviewHow To Write A SQL Server Performance Review
How To Write A SQL Server Performance Review
 
Get Your Boss To Say Yes
Get Your Boss To Say YesGet Your Boss To Say Yes
Get Your Boss To Say Yes
 
Sql Server Service Broker In The Real World
Sql Server Service Broker In The Real WorldSql Server Service Broker In The Real World
Sql Server Service Broker In The Real World
 
Perfmon And Profiler 101
Perfmon And Profiler 101Perfmon And Profiler 101
Perfmon And Profiler 101
 

Dernier

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Dernier (20)

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 

Advanced Index Tuning for SQL Server