Presentation is loading. Please wait.

Presentation is loading. Please wait.

SQL Server Performance Audit and Tuning Jason Pack.

Similar presentations


Presentation on theme: "SQL Server Performance Audit and Tuning Jason Pack."— Presentation transcript:

1 SQL Server Performance Audit and Tuning Jason Pack

2 Overview Using Performance Monitor Using Performance Monitor Hardware and Operating System Performance Hardware and Operating System Performance SQL Server Configuration Settings SQL Server Configuration Settings Database Configuration Settings Database Configuration Settings Index Performance Tuning Index Performance Tuning Application Tuning Application Tuning SQL Profiler on Queries SQL Profiler on Queries

3 Performance Monitor

4 Performance Monitor (2) Typical counters to monitor: Typical counters to monitor: Pages per second (memory)Pages per second (memory) Want to average less than 20 Want to average less than 20 Available bytes (memory)Available bytes (memory) Should be over 5MB (on dedicated machine) Should be over 5MB (on dedicated machine) Percent disk time (physical disk)Percent disk time (physical disk) Over 55% for 10+ minutes indicates a bottleneck Over 55% for 10+ minutes indicates a bottleneck Percent processor timePercent processor time Over 80% for 10+ minutes indicates a bottleneck Over 80% for 10+ minutes indicates a bottleneck

5 Tuning Hardware and Operating System Performance More RAM = Good More RAM = Good Check disk fragmentation Check disk fragmentation Separate operating system files and SQL Server data files Separate operating system files and SQL Server data files Be sure OS has newest SP Be sure OS has newest SP Server should be configured as stand-alone server Server should be configured as stand-alone server Turn off unnecessary services Turn off unnecessary services

6 SQL Server Configuration Settings In general, no need to modify In general, no need to modify If you have to If you have to SP_CONFIGURE, will show your settingsSP_CONFIGURE, will show your settings SP_CONFIGURE ['configuration name'], [configuration setting value] GO RECONFIGURE WITH OVERRIDE GO, to change the settingsSP_CONFIGURE ['configuration name'], [configuration setting value] GO RECONFIGURE WITH OVERRIDE GO, to change the settings

7 Database Configuration Right-click the database in Enterprise Manager, select Properties, then Options Right-click the database in Enterprise Manager, select Properties, then Options

8 Database Configuration (2) For reporting databases, set to Read- only For reporting databases, set to Read- only Database auto-grow Database auto-grow Transaction log auto-grow Transaction log auto-grow Estimate well, auto-grow creates virtual files, increasing recovery timeEstimate well, auto-grow creates virtual files, increasing recovery time

9 Index Performance Tuning Run the Index Tuning Wizard Run the Index Tuning Wizard Only available in Enterprise editionOnly available in Enterprise edition Start with busiest database, and largest tables Start with busiest database, and largest tables Every table, in every database, should have a clustered index on the PK Every table, in every database, should have a clustered index on the PK Allows the data to be stored, physically, in orderAllows the data to be stored, physically, in order

10 Application Tuning Most important aspect in improving performance Most important aspect in improving performance Not always possible Not always possible

11 Application Tuning (2) Use stored procedures whenever possible Use stored procedures whenever possible Include SET NOCOUNT ON in stored procedureInclude SET NOCOUNT ON in stored procedure Keep transactions as short as possible Keep transactions as short as possible Choose OLE DB over ODBC, as it is generally faster Choose OLE DB over ODBC, as it is generally faster Don’t return more data than you need Don’t return more data than you need

12 SQL Profiler Events Events Stored ProceduresStored Procedures RPC:Completed RPC:Completed TSQLTSQL SQL:BatchComplete d SQL:BatchComplete d Filters Filters Duration > 5000 msDuration > 5000 ms No system eventsNo system events Data Columns Data Columns Duration (group by) Event Class Database Identifier TextData CPU Writes Reads SPID

13 SQL Profiler (2)

14 References SQL-Server-Performance.Com, Brad McGehee, February 2005 SQL-Server-Performance.Com, Brad McGehee, February 2005 http://www.sql-server-performance.com/sql_server_performance_audit10.asphttp://www.sql-server-performance.com/sql_server_performance_audit10.asphttp://www.sql-server-performance.com/sql_server_performance_audit10.asp Microsoft MSDN, Meier, J. D., Vasireddy, S., Babbar, A., et al., May 2004 Microsoft MSDN, Meier, J. D., Vasireddy, S., Babbar, A., et al., May 2004 http://msdn.microsoft.com/library/default.asp?url=/library/en- us/dnpag/html/scalenetchapt14.asphttp://msdn.microsoft.com/library/default.asp?url=/library/en- us/dnpag/html/scalenetchapt14.asphttp://msdn.microsoft.com/library/default.asp?url=/library/en- us/dnpag/html/scalenetchapt14.asphttp://msdn.microsoft.com/library/default.asp?url=/library/en- us/dnpag/html/scalenetchapt14.asp SQL-Server-Performance.Com, Geert Vanhove, June 2005 SQL-Server-Performance.Com, Geert Vanhove, June 2005 http://www.sql-server-performance.com/gv_monitoring_8_steps.asphttp://www.sql-server-performance.com/gv_monitoring_8_steps.asphttp://www.sql-server-performance.com/gv_monitoring_8_steps.asp Microsoft MSDN Microsoft MSDN http://msdn.microsoft.com/library/default.asp?url=/library/en- us/createdb/cm_8_des_05_2ri0.asphttp://msdn.microsoft.com/library/default.asp?url=/library/en- us/createdb/cm_8_des_05_2ri0.asphttp://msdn.microsoft.com/library/default.asp?url=/library/en- us/createdb/cm_8_des_05_2ri0.asphttp://msdn.microsoft.com/library/default.asp?url=/library/en- us/createdb/cm_8_des_05_2ri0.asp


Download ppt "SQL Server Performance Audit and Tuning Jason Pack."

Similar presentations


Ads by Google