標籤:
EXPLAIN Extra 列資訊:
explain Extra列輸出包含了關於mysql如何解決query的額外資訊,特別是出現Using filesort 和 using temporary時,應當格外注意:
1:Child of ‘table‘ pushed [email protected]
在做join時下推到NDB儲存引擎中,引用子表‘table’,當下推join支援時,應用與Mysql cluster;
2: const row not found
通過一個query sql 例如 select... from tbl_name ,表為空白是出現;
3:deleting all row
對於delete操作,一些儲存引擎(MyISAM)支援一種簡單並且快速的刪除所有行的處理方法,如果該engine用這種最佳化,會顯示;
4:Distinct
mysql尋找distinct值,找到一個匹配之後就會立刻停止。
5:FirstMatch(tbl_name)
對tbl_name進行了semi-join firstmatch最佳化。
6:Full Scan on null key
子查詢最佳化,當最佳化器不能使用索引尋找訪問的時候,採用回退策略。
7:Impossible Having
Having 語句總是 false,不能返回任何行。
8:Impossible Where
見上。
9:Impoosible where noticed after reading const tables
讀完所有const(system) tables時,發現where語句總是返回false.
10: LooseScan(m..n)
Semi-join 鬆散策略被使用,m 和 n 是key 的一部分;
11: Materialize,scan
在mysql 5.6.7之前,這個只能用來表示物化暫存資料表。如果有scan表示在表讀取的時候沒有索引暫存資料表的索引。
在mysql 5.6.7之後,物化由select_type使用materialized說明,並且table的值為<subqueryN>。
12: No matching min/max row
沒有滿足查詢例如SELECT MIN(...) FROM ... WHERE condition的行結果。
13: No matching row in const table
一個查詢使用了join,有空表,或者在unique index 條件下沒有匹配上的行。
14: No matching rows after partition pruning
發生分區清理之後發現沒有東西能夠被delete或者update,和impossible where意思一樣。
15: start temporary,end temporary
表示暫存資料表被用來semi-join去重複策略
16: unique row not found
沒有滿足在primary key和unique上的行。
17: using filesort
MySQL必須做一些事,讓資料以排序的順序被讀取。
18: using index
只從index上讀取資料,不從表上讀取資料。如果extra還有using where,意味著用使用索引來做索引尋找。如果沒有using where最佳化器會讀索引但是不表示是索引尋找。
19: using index condition
表通過上訪問索引和過濾索引的方式來確定是否要讀取所有的表資料。這種方式下,索引用來延遲訪問表資料,除非有需要。
20: using index for group-by
和using index 類似,這個表名mysql發現有索引可以用來group by或者distinct
21:using join buffer(block nested loop),using join buffer(batched key access)
block nested loop表名block nested-loop演算法,batched key access表示使用batched key access演算法
解析MYsql explain執行計畫extra列輸出