在select窗口中,執行以下語句:
set profiling =1; -- 打開profile分析工具
show variables like '%profil%'; -- 查看是否生效
show processlist; -- 查看進程
use cmc; -- 選擇數據庫
show PROFILE all; -- 全部分析的類型
show index from t_log_account; ##查看某個表的索引
show index from t_car_copy; ##查看某個表的索引
-- 使用explain命令查看query語句的性能:
EXPLAIN select * from t_car_copy ; ##查看執行計劃中的sql性能
EXPLAIN select * from t_car_copy where org_id = '3';
EXPLAIN select * from t_car_copy where 1=1 and org_id = '3';
其余參考以下文章: