Simple SQL Server Performance Tuning

Source: Internet
Author: User

The purpose is to view the system (ApplicationProgram+ Database) Performance of calling SQL stored procedure stored procedures and SQL statements. How slow is it? Which Stored Procedure consumes the most time?

Sometimes when you set several indexes (clustered/non-clustered index) in a table, the result is still very slow (full table scan), because your index is not hit at all, it does not appear in where or order by at all!

1. Open profiler:

"Start-programs-SQL server2005-Performance Tools-SQL Server Profiler"

2. Click the first button in the toolbar-"New trace ..."

3. In the first tab: general, tick "Save to table" and output it to the table.

Select the master database in the pop-up window. The table name is random, for example, JQ

4. In the second tab: Events selection, do not select the Security and session sections. Only the stored procedure and SQL statements are selected.

5. Click Run.

If an error occurs: "Only TrueType fonts are supported. there id not a TrueType font ", select" choose font... "select another font.

6. After the monitoring starts, start the application. You can monitor the peak hours as long as you want. After monitoring, click STOP.

 

 

7. Open SQL Server Management studio, link to the master database, and enter the SQL statement:

Select top 500 * From JQ order by duration DESC;

8. You can see the most time-consuming stored procedure. Next, we will analyze the SQL statements of each stored procedure.

You can check the execution plan.

Menu: "query"-"display estimated execution plan ."

 

9. Modify and optimize the SQL statement. Repeat the preceding steps.

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.