SQL statement performance test

Source: Internet
Author: User
As the complexity of the software system increases, there may be many bottlenecks in the performance of the software system, which may be code, application server, front-end interface layer, or middleware, also, it may be Database. There are two bottlenecks in the database: one is the database architecture and design problems, and the other is submitted for processing. SQLThe statement is incorrect.

According to statistics, in the database application system, most of the performance problems are caused by inefficient SQL statements, accounting for more than 80% of the performance problems. This reminds us that the SQL statements in the Software SystemTestAnd Performance Tuning cannot be ignored. We need to optimize SQL statements to avoid many database performance problems.

  SQL test and optimization process

A standard SQL test and optimization process requires four iteration steps:

(1) identify problematic SQL statements

The first step is to find the SQL statements that cause performance problems. These SQL statements may be embedded in front-end program code and may be stored in backend database objects, such as stored procedures and views.

For those dynamically constructed SQL statements, that is, they are combined to create executable SQL statements only when the program is executed, we can use some tools to capture them, such as for sqlserver, you can use the included event probe.

(2) Optimize SQL statements

Step 2: prepare appropriate data in the database, execute SQL statements, and view performance. Data PreparationWorkYou can write an insert statement or use some existing tools (such as DataFactory.

........................

See full text click to download: http://www.51testing.com/html/82/n-141082.html

Here, SQL optimizer automatically analyzes the database execution plan of this SQL statement. The auto tune function of SQL optimizer intelligently analyzes a given SQL statement to find the semantic consistency of replaceable statements, that is, to find the same results that can be queried, however, different SQL statements are written.

For example, the following SQL statement can use the in Keyword:

However, to get the same query result, we can also use the exists keyword, except that the statement is written differently:


Reprint: http://www.51testing.com /? Action-viewnews-itemid-142060

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.