当前位置: 代码迷 >> MySQL >> mysql 性能辨析
  详细解决方案

mysql 性能辨析

热度:113   发布时间:2016-05-05 16:47:49.0
mysql 性能剖析

profile 使用实例

set profiling_history_size=100;

show VARIABLES like 'pro%'

?

SELECT * from center_goods where goods_id LIMIT 200000,20

?

?

show PROFILES

?

?

set @query_id=43;

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; ?

  相关解决方案