Home >Database >Mysql Tutorial >How to check the running time of mysql statement

How to check the running time of mysql statement

王林
王林Original
2020-09-30 14:07:254706browse

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.

How to check the running time of mysql 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;

How to check the running time of mysql statement

Then execute show profiles; you can view the total of all sql execution time.

How to check the running time of mysql statement

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!

Statement:
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