mysql>set profiling=1;
mysql>show profiles;
mysql> set @query_id=6;Query OK, 0 rows affected (0.00 sec)mysql> select state,sum(duration) as total_R,round(100*sum(duration)/(select sum(duration) from information_schema.profiling where query_id=@query_id),2) as Pct_R,count(*) as Calls,sum(DURATION)/count(*) as "R/Call" from information_schema.profiling where query_id=@query_id group by state order by Total_R DESC;
+----------------------+----------+-------+-------+--------------+| state | total_R | Pct_R | Calls | R/Call |+----------------------+----------+-------+-------+--------------+| Sending data | 0.026548 | 44.76 | 1 | 0.0265480000 || init | 0.025457 | 42.92 | 1 | 0.0254570000 || System lock | 0.005633 | 9.50 | 1 | 0.0056330000 || query end | 0.001312 | 2.21 | 1 | 0.0013120000 || freeing items | 0.000155 | 0.26 | 1 | 0.0001550000 || starting | 0.000076 | 0.13 | 1 | 0.0000760000 || Opening tables | 0.000029 | 0.05 | 1 | 0.0000290000 || statistics | 0.000019 | 0.03 | 1 | 0.0000190000 || cleaning up | 0.000019 | 0.03 | 1 | 0.0000190000 || closing tables | 0.000017 | 0.03 | 1 | 0.0000170000 || end | 0.000015 | 0.03 | 1 | 0.0000150000 || preparing | 0.000012 | 0.02 | 1 | 0.0000120000 || optimizing | 0.000011 | 0.02 | 1 | 0.0000110000 || checking permissions | 0.000011 | 0.02 | 1 | 0.0000110000 || executing | 0.000002 | 0.00 | 1 | 0.0000020000 |+----------------------+----------+-------+-------+--------------+