MySQL profiling Performance Analysis Tool
Brief description:
MySQL Query Profiler is a very convenient Query diagnostic and analysis tool that can be used to obtain the consumption of multiple resources in a Query throughout the execution process, such as CPU, IO, IPC, SWAP, page faults, context switche, and so on. The location of the functions called by MySQL in the source file during Query execution can also be obtained.
Through slow log query, we can know which SQL statements are inefficient in execution. Through the explain command, we can know the specific execution status and index usage of the SQL statements. We can also view the execution status using the show command. If you think that the explain information is not detailed enough, you can use the profiling command to obtain more accurate information about system resources consumed by SQL Execution.
Profiling is disabled by default.
1. show variables like '% profiling %'; (view profiling information)
2. set profiling = 1; (enable profiling)
3. Execute SQL query
Example: select goods_name from ecs_goods where goods_id <5000;
Show profiles;
4. show profile for query 4;
The show profile format is as follows:
# The ideal of life is for ideal life! #
This article permanently updates the link address: