Mysql高級 (3) -- 使用profile來分析sql

謹記:只對本次會話有效sql

-- 查看Profiling的狀態 
show variables like 'profiling';

-- 開啓profile
set profiling=on;


-- 測試語句 1
SELECT * from emp GROUP BY id%10 limit 150000

-- 測試語句 2 
select * from emp GROUP BY id%20 ORDER BY 5;


-- 查看執行sql的用時時間
show profiles;

-- 查看具體的sql語句執行的詳細時間消耗
show profile cpu,block io for query 3;

 

 

全局日誌 測試

相關文章
相關標籤/搜索