extendexplain extended+show warnings
例子:
mysql>?explain?extended?select?*?from?user_score?us??inner?join?user_info?ui?on?us.uid?=?ui.uid?where?us.id?=?5;
+----+-------------+-------+-------+-------------------+---------+---------+-------+---------+----------+-------------+
|?id?|?select_type?|?table?|?type??|?possible_keys?????|?key?????|?key_len?|?ref???|?rows????|?filtered?|?Extra???????|
+----+-------------+-------+-------+-------------------+---------+---------+-------+---------+----------+-------------+
|??1?|?SIMPLE??????|?us????|?const?|?PRIMARY,index_uid?|?PRIMARY?|?4???????|?const?|???????1?|???100.00?|?NULL????????|
|??1?|?SIMPLE??????|?ui????|?ALL???|?NULL??????????????|?NULL????|?NULL????|?NULL??|?2989934?|???100.00?|?Using?where?|
+----+-------------+-------+-------+-------------------+---------+---------+-------+---------+----------+-------------+
2?rows?in?set,?1?warning?(0.00?sec)
mysql>?show?warnings;
+-------+------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|?Level?|?Code?|?Message??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????|
+-------+------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|?Note??|?1003?|?/*?select#1?*/?select?'5'?AS?`id`,'111111111'?AS?`uid`,'100'?AS?`score`,`test`.`ui`.`id`?AS?`id`,`test`.`ui`.`uid`?AS?`uid`,`test`.`ui`.`name`?AS?`name`?from?`test`.`user_score`?`us`?join?`test`.`user_info`?`ui`?where?(('111111111'?=?convert(`test`.`ui`.`uid`?using?utf8mb4)))?|
+-------+------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1?row?in?set?(0.00?sec)
通過? show?warnings? 更好的發(fā)現(xiàn)sql問題 上面就是平時不太容易發(fā)現(xiàn)的 字符集轉(zhuǎn)換導(dǎo)致索引失效問題?