SlideShare ist ein Scribd-Unternehmen logo
1 von 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

Weitere ähnliche Inhalte

Ähnlich wie 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
 

Ähnlich wie 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
 

Mehr von 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
 

Kürzlich hochgeladen

Kürzlich hochgeladen (20)

Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
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...
 
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
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
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?
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.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
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
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
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
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
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 

Advanced Index Tuning for SQL Server