暂无图片
Impossible where noticed after reading const tables
我来答
分享
曾经的zeng
2019-09-26
Impossible where noticed after reading const tables

慢查询出现该语句:select * from table where a=‘a’ limit 10; 执行时间为5.2s。手动查询很快,执行计划Impossible where noticed after reading const tables。请问下这个会走全表吗,高并发下会导致性能问题吗

我来答
添加附件
收藏
分享
问题补充
4条回答
默认
最新
Cui Hulong

可以理解为真的去实际访问了一遍数据后,得出的结果。

Impossible WHERE noticed after reading const tables 说明官网里有:

const is used when you compare all parts of a PRIMARY KEY or UNIQUE index to constant values. In the following queries, tbl_name can be used as a const table:

https://dev.mysql.com/doc/refman/5.7/en/explain-output.html


暂无图片 评论
暂无图片 有用 0
RooT
2022-06-11
并不会真的实际访问一遍数据库,由于是主键或唯一索引,所以遍历一遍索引树即可;
曾经的zeng

为一个不存在的值不走索引而走一次全表,那这个特性的设计不是很BUG吗,为何手动执行又很快呢

暂无图片 评论
暂无图片 有用 0
曾经的zeng

为一个不存在的值不走索引而走一次全表,那这个特性的设计不是很BUG吗,为何手动执行又很快呢

暂无图片 评论
暂无图片 有用 0
RooT

mark

暂无图片 评论
暂无图片 有用 0
回答交流
提交
问题信息
请登录之后查看
邀请回答
暂无人订阅该标签,敬请期待~~
暂无图片墨值悬赏