Measure MySQL Query
Sep 3, 2021
If you are interested to measure exact time your query is taking this article is for you
if you have to enable profile in mysql
SET profiling = 1;
Now execute any query i.e.,
SELECT TABLE_NAME, UPDATE_TIME
FROM information_schema.tables
WHERE TABLE_SCHEMA = ‘abc’
ORDER BY UPDATE_TIME DESC;
Now run
SHOW PROFILES;
Now mysql will show you something like this
You can get more details about any query using its Query_id
SHOW PROFILE FOR QUERY 1;
You can stop query profiling using following command
SET profiling = 0;