MySQL SQL statement performance tuning simple example When doing server development, sometimes there are certain requirements for concurrency, and sometimes it is a certain SQL statement, such as a stored procedure, that affects the speed. Now suppose that during the execution of the server code, a certain SQL statement executes slowly. How can we optimize it? Suppose now the server code executes the following SQL stored procedure very slowly: call sp_wplogin_register(1, 1, 1, '830000', '222222'); You can debug as follows: 1. Open mysql profiling: 2. Then execute the SQL that needs to be tuned. Here we execute two SQL statements, one commit statement and the other one is to call the above stored procedure statement: 3. Use profiling to display the execution time of each SQL statement. The stored procedure consists of a series of SQL statements, which are also broken down and displayed here: It can be seen that the execution speed of the sql marked in red is far from the same level as other sql statements. We optimize this row, for example, by creating an index for the field f_phone. Thank you for reading, I hope it can help you, thank you for your support of this site! You may also be interested in:
|
<<: Creating a file system for ARM development board under Linux
>>: Steps to transplant the new kernel to the Linux system
Recently, when using kazam in Ubuntu 20.04 for re...
Table of contents question 1. Install webpack web...
Description: Limit the number of lines of text di...
I just happened to encounter this small requireme...
Table of contents 1. Container service update and...
Last night, I was looking at an interview question...
How to use the code in NetEase Blog: First log in...
In Vue, we can define (register) local components...
Table of contents 1. Concepts related to stored p...
/**************************** * System call******...
This article shares the specific code of Vue3 man...
About CSS3 variables When declaring a variable, a...
Usually in project development, we have to deal wi...
Table of contents Preface Mysql case when syntax:...
1. One-stop solution 1. Problem analysis and loca...