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 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!