Home >Database >Mysql Tutorial >How to check the running time of mysql statement
How to check the running time of mysql statement: first execute the [set profiling = 1;] command to open the query profiler tool; then execute the [show profiles;] command to check the running time of the sql statement.
Query Profiler is a query diagnostic analysis tool that comes with MYSQL. It can locate various resource consumption of a SQL statement execution, such as CPU, IO, etc., and the time it takes to execute the SQL, etc.
(Recommended tutorial: mysql tutorial)
First check whether the profile is turned on. The database is not turned on by default.
Check whether it is enabled:
show variables like "%pro%";
Set the enable method:
set profiling = 1;
Then execute show profiles; you can view the total of all sql execution time.
Related recommendations: php training
The above is the detailed content of How to check the running time of mysql statement. For more information, please follow other related articles on the PHP Chinese website!