SQL Query Performance Tuning
ch1
11/16/2019 Rashmi Gupta 1
SQL Query Performance Tuning
• The Performance-Tuning Process
– The Core Process
– Iterating the Process
• Performance vs. Price
– Performance Targets
– “Good Enough” Tuning
• Performance Baseline
• Where to Focus Efforts
11/16/2019 Rashmi Gupta 2
SQL Query Performance Tuning Contd.
• SQL Server Performance Killers
– Poor Indexing
– Inaccurate Statistics
– Excessive Blocking and Deadlocks
– Non-Set-Based Operations
– Poor Query Design
– Poor Database Design
– Excessive Fragmentation
– Nonreusable Execution Plans
– Poor Execution Plans
– Frequent Recompilation of Execution Plans
– Improper Use of Cursors
– Improper Configuration of the Database Log
– Excessive Use or Improper Configuration of tempdb
• Summary
11/16/2019 Rashmi Gupta 3
The Core Process
• Is any other resource intensive process is
running on the same server?
• Is the hardware subsystem is capable to
withstand the maximum workload?
• Is the SQL server configured Correctly?
• Is the database connection between SQL
server and The database application is
efficient?
11/16/2019 Rashmi Gupta 4
The Core Process
• Does he database support the fastest data
retrieval ?
• Is the user workload consisting of SQL Queries
is optimized to reduce load on SQL Server?
• What processes are causing the system to
slow down as reflected in the measurement
various wait states
• Does the workload support the maximum
concurrency?
11/16/2019 Rashmi Gupta 5
Performance
Tuning
Process
11/16/2019 Rashmi Gupta 6
Time Spent versus Performance Gain
11/16/2019 Rashmi Gupta 7
Summary
• Performance tuning is an iterative process
• Create a baseline and measure against it
• Avoid SQL performance Killers
11/16/2019 Rashmi Gupta 8
11/16/2019 Rashmi Gupta 9