MySQL statistics output
I have a SQL file with temporary tables creation, some load data infile, some selects and some updates.
I would like to know the time spent on each statement, through the CLI on the shell. If my file contains:
SELECT "Step 1" AS '';
SELECT col1, col2 FROM t1 ORDER BY col3;
And I run:
mysql -h host db < file
The output I would like to get is:
Step 1 1 row in set (0.00 sec) col1 col2 20073 0724081 20073 0724685 20073 0726347 20073 0726932 20073 开发者_开发百科0733623 5 rows in set (0.00 sec)
Tne 1 row in set (0.00 sec)
and 5 rows in set (0.00 sec)
are the information i'm looking for, NOT the Un*x time for the process.
I've tryied different mysql
options, even --show-warnings --i-am-a-dummy
to no avail. Is there a way to get the requested info?
Thanks,
EDIT: Added missing time for first select.
try mysql profiler - http://dev.mysql.com/tech-resources/articles/using-new-query-profiler.html
My guess is you are losing the timing data due to rounding. (eg, your query is taking A LOT less than 0.001 seconds.
精彩评论