这一条语句查询几十毫秒, 解释器看是走时间字段索引的。
select * from table1 where 1=1
and createtime
between to_date('2020-04-30 00:00:00','yyyy-MM-dd hh24:mi:ss')
and to_date('2020-04-30 23:59:59','yyyy-MM-dd hh24:mi:ss')
如下语句就是三天, 就会卡顿很久, 加上hint强制索引就很快。 不加hint就很慢。 只有04-27 会卡, 04-26, 04-28 就不卡
select * from table1 where 1=1
and createtime
between to_date('2020-04-27 00:00:00','yyyy-MM-dd hh24:mi:ss')
and to_date('2020-04-30 23:59:59','yyyy-MM-dd hh24:mi:ss')
如下 开始时间加一个小时又没问题。
或者开始时间为 2020-04-26等前几天的时间查询都没问题, 就是卡顿在 2020-04-27 00:00:00
这是为什么呢
select * from table1 where 1=1
and createtime
between to_date('2020-04-27 01:00:00','yyyy-MM-dd hh24:mi:ss')
and to_date('2020-04-30 23:59:59','yyyy-MM-dd hh24:mi:ss')