小编ari*_*lCo的帖子

Oracle根据to_date(literal)的格式使用或忽略索引列

我使用索引列作为过滤器,将其置于'两个文字值之间'.(该列位于索引的第二个位置,实际上使执行速度变慢;我将在稍后处理).

令我困惑的是Oracle(11.2.0.3.0)根据提供给to_date的值的格式和格式字符串使用或忽略所述索引:

这忽略了索引:

SQL> SELECT *
  2  FROM gprs_history_import  gh
  3  WHERE start_call_date_time BETWEEN
  4      to_date('20140610 000000','yyyymmdd hh24miss') AND
  5      to_date('20140610 235959','yyyymmdd hh24miss')
  6  /

Execution Plan
----------------------------------------------------------
Plan hash value: 990804809

--------------------------------------------------------------------------------------------------------------
| Id  | Operation              | Name                | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |
--------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT       |                     |   350 |   219K|   242K  (1)| 00:56:42 |       |       |
|   1 |  PARTITION RANGE SINGLE|                     |   350 |   219K|   242K  (1)| …
Run Code Online (Sandbox Code Playgroud)

oracle indexing to-date

6
推荐指数
1
解决办法
614
查看次数

标签 统计

indexing ×1

oracle ×1

to-date ×1