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