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

How to check mysql statement running time

coldplay.xixi
coldplay.xixiOriginal
2020-10-10 17:01:483648browse

How to check the running time of mysql statement: use timestampdiff to check the execution time, the code is [select * from comment;select timestampdiff(second,@d,now());].

How to check mysql statement running time

How to check the running time of mysql statement:

Use timestampdiff to check the execution time.

One thing to note about this method is that the three sql statements must be executed together as much as possible, otherwise the error will be too large and it will not be accurate at all

set @d=now();
select * from comment;
select timestampdiff(second,@d,now());

If it is executed using the command line, there is one point It should be noted that after select timestampdiff(second,@d,now());, you must copy an extra blank line, otherwise the last sql will require you to press Enter to execute it yourself, which will be inaccurate.

Related free learning recommendations: mysql database (video)

The above is the detailed content of How to check mysql statement running time. 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