标签:版本 xpl list session pre ike index 去掉 evel
explain (select count(*)
from session
where status = 2
and playback_state = 1
and closed > ‘2018/10/17‘
and closed < ‘2018-10-18‘);
explain (select count(*)
from session
where status = 2
and playback_state = 1
and closed like ‘2018-10-17%‘);
explain (select count(*)
from session
where status = 2
and playback_state = 1
and closed > 1539705600
and closed < 1539792000);
explain (select count(*)
from session
where status = 2
and playback_state = 1
and closed > unix_timestamp(‘2018/10/17‘)
and closed < unix_timestamp(‘2018-10-18‘));
mysql查询时,不管有多少个单个索引或联合索引,永远只使用一个索引。
具体使用哪个索引进行查询,由mysql进行选择,会选择一个它认为最合适的一个字段。在以上情况中,其选择了playback_state,而非closed。
MySQL 搜索指定时间范围数据, 时间字段有索引但是还是很费时
标签:版本 xpl list session pre ike index 去掉 evel
原文地址:https://www.cnblogs.com/Zereker/p/11396623.html