Home > Database > Mysql Tutorial > body text

Share an example tutorial on sql statement performance tuning

零下一度
Release: 2017-06-17 17:32:19
Original
1627 people have browsed it

This article mainly introduces the relevant information of simple examples of mysql sql statement performance tuning. Friends in need can refer to

mysql sql Simple example of statement performance tuning

When doing server development, sometimes there are certain requirements for concurrency. Sometimes what affects the speed is a certain SQL statement, such as a certain stored procedure . Now suppose that during the execution of the server code, a certain SQL is executed slowly. How to optimize it?

If the server code now executes the following sql stored procedure very slowly:


call sp_wplogin_register(1, 1, 1, '830000', '222222');
Copy after login

You can proceed as follows Debugging:

1. Open mysql profiling:


2. Then execute the SQL that needs to be tuned, we execute it here Two sql, one commit statement, and the other is to call the above stored procedure statement:


3. Use profiling to display each statement The execution time of SQL, in which the stored procedure consists of a series of SQL, is also broken down and displayed here:


You can see the red marked The execution speed of SQL is far from the same level as other SQL statements. We optimize this line, such as establishing an index for the field f_phone.

The above is the detailed content of Share an example tutorial on sql statement performance tuning. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template