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');
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!