問題描述:學習時,p172舉例explainselect*fromproductsfromactor='SEANCARREY'andtitlelike'%APOLLO%',解釋這里索引無法覆蓋該查詢的原因其中第二個是:MySQL不能在索引中執(zhí)行LIKE操作.但是我實際發(fā)現(xiàn),即使索引執(zhí)行了LIKE也是可以覆蓋索引的!演示代碼:--基于MySQL版本:8.0.16--創(chuàng)建一個只有2個字段的表droptableifexistsproducts;createtableproducts(actorvarchar(20),titlevarchar(20));--創(chuàng)建覆蓋所有字段的索引,并未指定索引長度createindexidx_actor_titleonproducts(actor,title);--索引執(zhí)行LIKE操作,查看explain結(jié)果explainselect*fromproductswhereactor='SEAN'andtitlelike'%APOLLO%';執(zhí)行結(jié)果是:Extra是Usingwhere;Usingindex,所以說即使執(zhí)行了LIKE也還是覆蓋索引請問是MySQL版本的問題嗎,還是我的理解有問題?感謝!
請教各位一個問題,求解答:MySQL覆蓋索引時允許索引執(zhí)行LIKE操作嗎?跪求!
Qyouu
2019-08-24 22:09:12