我有以下查询
select count(inspection_result)
from test
where (inspection_time between "2015-07-14 00:00:00" and "2015-07-14 00:59:59" )
and inspection_result= 0 and part_type = "39000048" and location = "1"
当我执行Explain
时,它会给我一个352
的确切行,它与计数结果相同。
但是当我执行以下查询的解释时
select count(inspection_result)
from test
where (inspection_time between "2015-07-14 00:00:00" and "2015-07-14 00:59:59" )
and inspection_result= 1 and part_type = "39000048" and location = "1"
它显示的行数393397
,而输出为71280
。
因此,它影响了我的查询速度。任何人都可以帮助我为什么这样的查询行为。