首頁  >  文章  >  資料庫  >  在MySQL中的explain中的using where和using index

在MySQL中的explain中的using where和using index

little bottle
little bottle轉載
2019-04-18 15:48:514795瀏覽

本篇文章的主要內容是關於在mysql資料庫explain中的using where和using index的使用,有興趣的朋友可以了解一下。

1. 檢視表格中的所有索引 show index from modify_passwd_log;  有兩個一個是id的主鍵索引, 一個是email_id的普通索引 

# 2. using index表示使用到了索引, 並且所取的資料完全在索引中就能拿到

explain select email_id from modify_passwd_log where email_id=670602;

##3. type是ref,where是空白:使用到了索引,但是查詢的資料有沒在索引中的,回表去拿資料了

explain select * from modify_passwd_log where email_id=670602;

4. type是ref , where是using where ,表示使用到了索引, 但是也進行了where過濾

#### ## 推薦課程:###mysql影片教學######

以上是在MySQL中的explain中的using where和using index的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:cnblogs.com。如有侵權,請聯絡admin@php.cn刪除