使用 Explain 命令來查看語句的執(zhí)行計劃
例:Explain select * from table
除過select,其他比如insert,update和delete均可以使用explain查看執(zhí)行計劃
概要描述:
id:選擇標識符
select_type:表示查詢的類型。
table:輸出結(jié)果集的表
partitions:匹配的分區(qū)
type:表示表的連接類型 :ALL、index、range、 ref、eq_ref、const、system、NULL(從左到右,性能從差到好)
possible_keys:可能使用的索引
key:實際使用的索引
key_len:索引字段的長度
ref:列與索引的比較
rows:掃描出的行數(shù)(估算的行數(shù))
filtered:按表條件過濾的行百分比
Extra:執(zhí)行情況的描述和說明
————————————————
原文鏈接:https://blog.csdn.net/yao583224426/article/details/121691683