Upload
logan-wheeler
View
238
Download
1
Tags:
Embed Size (px)
Citation preview
OverviewOverview
Using Performance MonitorUsing Performance Monitor Hardware and Operating System Hardware and Operating System
PerformancePerformance SQL Server Configuration SettingsSQL Server Configuration Settings Database Configuration SettingsDatabase Configuration Settings Index Performance TuningIndex Performance Tuning Application TuningApplication Tuning SQL Profiler on QueriesSQL Profiler on Queries
Performance Monitor (2)Performance Monitor (2)
Typical counters to monitor:Typical counters to monitor:
• Pages per second (memory)Pages per second (memory) Want to average less than 20Want 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 bottleneckOver 55% for 10+ minutes indicates a bottleneck
• Percent processor timePercent processor time Over 80% for 10+ minutes indicates a bottleneckOver 80% for 10+ minutes indicates a bottleneck
Tuning Hardware and Operating Tuning Hardware and Operating System PerformanceSystem Performance
More RAM = GoodMore RAM = Good Check disk fragmentationCheck disk fragmentation Separate operating system files and Separate operating system files and
SQL Server data filesSQL Server data files Be sure OS has newest SPBe sure OS has newest SP Server should be configured as Server should be configured as
stand-alone serverstand-alone server Turn off unnecessary servicesTurn off unnecessary services
SQL Server Configuration SettingsSQL Server Configuration Settings
In general, no need to modifyIn general, no need to modify If you have toIf you have to
• SP_CONFIGURE, will show your settingsSP_CONFIGURE, will show your settings• SP_CONFIGURE ['SP_CONFIGURE ['configuration nameconfiguration name'], '],
[[configuration setting valueconfiguration setting value]]GOGORECONFIGURE WITH OVERRIDERECONFIGURE WITH OVERRIDEGO, to change the settingsGO, to change the settings
Database ConfigurationDatabase Configuration
Right-click the Right-click the database in database in Enterprise Enterprise Manager, select Manager, select Properties, then Properties, then OptionsOptions
Database Configuration (2)Database Configuration (2)
For reporting databases, set to Read-For reporting databases, set to Read-onlyonly
Database auto-growDatabase auto-grow
Transaction log auto-growTransaction log auto-grow• Estimate well, auto-grow creates virtual Estimate well, auto-grow creates virtual
files, increasing recovery timefiles, increasing recovery time
Index Performance TuningIndex Performance Tuning
Run the Index Tuning WizardRun the Index Tuning Wizard• Only available in Enterprise editionOnly available in Enterprise edition
Start with busiest database, and Start with busiest database, and largest tableslargest tables
Every table, in every database, Every table, in every database, should have a clustered index on the should have a clustered index on the PKPK• Allows the data to be stored, physically, Allows the data to be stored, physically,
in orderin order
Application TuningApplication Tuning
Most important aspect in improving Most important aspect in improving performanceperformance
Not always possibleNot always possible
Application Tuning (2)Application Tuning (2)
Use stored procedures whenever possibleUse stored procedures whenever possible• Include SET NOCOUNT ON in stored procedureInclude SET NOCOUNT ON in stored procedure
Keep transactions as short as possibleKeep transactions as short as possible Choose OLE DB over ODBC, as it is Choose OLE DB over ODBC, as it is
generally fastergenerally faster Don’t return more data than you needDon’t return more data than you need
SQL ProfilerSQL Profiler
EventsEvents• Stored ProceduresStored Procedures
RPC:CompletedRPC:Completed
• TSQLTSQL SQL:BatchCompletedSQL:BatchCompleted
FiltersFilters• Duration > 5000 msDuration > 5000 ms• No system eventsNo system events
Data ColumnsData Columns• Duration (group by)Duration (group by)• Event ClassEvent Class• Database IdentifierDatabase Identifier• TextDataTextData• CPUCPU• WritesWrites• ReadsReads• SPIDSPID
ReferencesReferences
SQL-Server-Performance.Com, Brad McGehee, February 2005SQL-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.asp
Microsoft MSDN, Meier, J. D., Vasireddy, S., Babbar, A., et al., May Microsoft MSDN, Meier, J. D., Vasireddy, S., Babbar, A., et al., May 20042004• http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag/html/scalhttp://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag/html/scal
enetchapt14.aspenetchapt14.asp
SQL-Server-Performance.Com, Geert Vanhove, June 2005SQL-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.asp
Microsoft MSDNMicrosoft MSDN • http://msdn.microsoft.com/library/default.asp?url=/library/en-us/createdb/cm_8_http://msdn.microsoft.com/library/default.asp?url=/library/en-us/createdb/cm_8_
des_05_2ri0.aspdes_05_2ri0.asp