简体   繁体   English

Mysql Explain Query显示类型“ ALL”

[英]Mysql Explain Query show type “ALL”

SELECT id FROM raod_busroute 
WHERE from_des LIKE '%adheriya khal%' AND to_des LIKE
'%abhayapuri%' GROUP BY from_des"

When I look at the result, I see it Reads the entire table—all rows and columns. 查看结果时,我看到它读取整个表-所有行和列。 I know this is bad, but I don't know how to fix this. 我知道这很糟糕,但我不知道如何解决。

Thanks 谢谢

Because you are doing a lookup with like with wildcards in the beginning of the string, mysql cannot use your indexes (if there are any). 因为您要在字符串的开头使用通配符进行like查找,所以mysql无法使用索引(如果有的话)。 It needs to do a full table scan. 它需要进行全表扫描。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM