explain plan for select *
from esb2_trans_log t
where t.trans_date >=
to_date('2018-06-07 00:00:00', 'yyyy-mm-dd hh24:mi:ss')
and t.trans_date <=
to_date('2018-06-07 23:59:59', 'yyyy-mm-dd hh24:mi:ss') ;
select * from table(dbms_xplan.display());
PLAN_TABLE_OUTPUT
1 Plan hash value: 1868862569
2
3 ---------------------------------------------------------------------------------------------------------
4 | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop |
5 ---------------------------------------------------------------------------------------------------------
6 | 0 | SELECT STATEMENT | | 17M| 3526M| 150K (1)| 00:30:06 | | |
7 | 1 | PARTITION RANGE SINGLE| | 17M| 3526M| 150K (1)| 00:30:06 | 6 | 6 |
8 |* 2 | TABLE ACCESS FULL | ESB2_TRANS_LOG | 17M| 3526M| 150K (1)| 00:30:06 | 6 | 6 |
9 ---------------------------------------------------------------------------------------------------------
10
11 Predicate Information (identified by operation id):
12 ---------------------------------------------------
13
14 2 - filter("T"."TRANS_DATE"<=TO_DATE(' 2018-06-07 23:59:59', 'syyyy-mm-dd hh24:mi:ss'))
explain plan for
select * from esb2_trans_log t
where t.trans_date=date'2018-06-07';
select * from table(dbms_xplan.display());
PLAN_TABLE_OUTPUT
1 Plan hash value: 1868862569
2
3 ---------------------------------------------------------------------------------------------------------
4 | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop |
5 ---------------------------------------------------------------------------------------------------------
6 | 0 | SELECT STATEMENT | | 222 | 46620 | 150K (1)| 00:30:05 | | |
7 | 1 | PARTITION RANGE SINGLE| | 222 | 46620 | 150K (1)| 00:30:05 | 6 | 6 |
8 |* 2 | TABLE ACCESS FULL | ESB2_TRANS_LOG | 222 | 46620 | 150K (1)| 00:30:05 | 6 | 6 |
9 ---------------------------------------------------------------------------------------------------------
10
11 Predicate Information (identified by operation id):
12 ---------------------------------------------------
13
14 2 - filter("T"."TRANS_DATE"=TO_DATE(' 2018-06-07 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))
where t.trans_date=date'2018-06-07'; 等价于 ("T"."TRANS_DATE"=TO_DATE(' 2018-06-07 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))