Performance Tuning for mysql SQL statements

Source: Internet
Author: User

Performance Tuning for mysql SQL statements

Performance Tuning for mysql SQL statements

In server development, there are sometimes requirements on the concurrency, and sometimes an SQL statement, such as a stored procedure, affects the speed. Now, if the execution of an SQL statement is slow during server code execution, how can we optimize it? Performance Tuning for mysql SQL statements

Assume that the following SQL stored procedure is particularly slow for server code execution:

Call sp_wplogin_register (1, 1, 1, '20160301', '20160301 ');

You can perform debugging as follows:

1. Open mysql profiling:

2. then execute the SQL to be optimized. Here we execute two SQL statements, one for commit, and the other for calling the above Stored Procedure statement:

3. Use profiling to display the execution time of each SQL statement. The stored procedure is composed of a series of SQL statements, which are also displayed here:

We can see that the SQL Execution speed at the red mark is far from the same level as other SQL statements. We optimized this line, for example, creating an index for the field f_phone.

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.