“Mysql 高性能笔记”的版本间的差异
来自Alex's wiki
(创建页面,内容为“ ==3.3.2 剖析单条性能== ===使用SHOW PROFILE=== 在会话级别使用 set profiling = 1; show profiles; show profile for query 1; 以上是默认输出,若...”) |
(没有差异)
|
2016年8月31日 (三) 03:46的版本
3.3.2 剖析单条性能
使用SHOW PROFILE
在会话级别使用 set profiling = 1; show profiles; show profile for query 1;
以上是默认输出,若要手动则执行以下语句:
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;