Pennsylvania Department of Public Welfare Office of Information Systems SQL Server Performance Gathering Version 1.0 March 11, 2004 DPW Business and Technical Standards Document Revised 03/11/04 SQL Server Performance Gathering Introduction This document will show the users how to fine tune the performance of a SQL Stored Procedure via the results of the execution plan. Purpose The purpose of this document is assisting the user in any performance tuning of a SQL Stored Procedure. SQL Server Performance Gathering.doc Page 2 of 8 DPW Business and Technical Standards Document Revised 03/11/04 SQL Server Performance Gathering 1. Open Query Analyzer 2. Change to correct database and enter query in window, or open the stored procedure. 3. Along top bar in query analyzer, under query choose ‘show execution plan’ Diagram 1. 4. Run the query. SQL Server Performance Gathering.doc Page 3 of 8 DPW Business and Technical Standards Document Revised 03/11/04 5. The results will display in results window. 6. Choose execution plan tab in the results window to see the execution plan. Diagram 2 SQL Server Performance Gathering.doc Page 4 of 8 DPW Business and Technical Standards Document Revised 03/11/04 7. Review the execution plan and identify any potential bottlenecks. Diagram 3 8. All execution plans total 100% cost, each step of plan adds up to 100%. 9. To find where highest cost is associated and analyze why, look for following bottlenecks: a. Table scans b. Hash/merge joins c. Sorts 10. Once problem areas are identified, begin to look at how process can be made better. a. Table scans, add indexes or choose different index b. Hash/merge joins – can inner join be done or left or right outer joins, can joins be broken up into correlated sub queries or smaller joins. c. Sorts, can data be sorted in another way or broken up into smaller sorts. SQL Server Performance Gathering.doc Page 5 of 8 DPW Business and Technical Standards Document Revised 03/11/04 11. Use other tools such as SQL Profiler or Performance Monitor to review code. Diagram 4 SQL Server Performance Gathering.doc Page 6 of 8 DPW Business and Technical Standards Document Revised 03/11/04 12. Also look at index tuning wizard to help gain insight into what indexes are used or are needed to improve performance. Diagram 5 13. If additional assistance is still needed contact DBA to help improve performance. 14. Lastly, test all new processes with and without user load. Determine baseline time before adding in complexity of multiple users. SQL Server Performance Gathering.doc Page 7 of 8 DPW Business and Technical Standards Document Revised 03/11/04 Document Change Log Change Date 03/11/04 Version CR # 1.0 SQL Server Performance Gathering.doc Change Description Initial creation. Author and Organization Kiley Milakovic Page 8 of 8
© Copyright 2026 Paperzz