MySQL的查询执行计划中,Extra列经常会出现“Using where; Using index”。
MySQL官方手册解释:
Using index不读数据文件,只从索引文件获取数据
Using where过滤元组和是否读取数据文件或索引文件没有关系
但MySQL手册在Using index处又说:
1 没有Using where只有Using index:则不读数据文件,所有字段都可以从索引上获得(Without Using where, the optimizer may be reading the index to avoid reading data rows but not using it for lookups)
2 同时有Using where和Using index:因为“Without Using where...”这句上下文,则意味着同时有Using where和Using index则一定需要读取数据文件
其实不然。“Using where只是过滤元组,和是否读取数据文件或索引文件没有关系”。