1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
create table t_date as select * from user_objects
/
create index ix_t_date on t_date(created)
/
exec dbms_stats.gather_table_stats('MNI','T_DATE')
/
set autotrace traceonly explain
/
select count(*)
from t_date
where created between to_date('16/11/2007','DD/MM/YYYY') and to_date('17/11/2007','DD/MM/YYYY')
/
Plan d'exÚcution
----------------------------------------------------------
Plan hash value: 471217560
-------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 8 | 1 (0)| 00:00:01 |
| 1 | SORT AGGREGATE | | 1 | 8 | | |
|* 2 | INDEX RANGE SCAN| IX_T_DATE | 3 | 24 | 1 (0)| 00:00:01 |
-------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("CREATED">=TO_DATE('2007-11-16 00:00:00', 'yyyy-mm-dd hh24:mi:ss') AND "CREATED"<=TO_DATE('2007-11-17 00:00:00', 'yyyy-mm-dd hh24:mi:ss')) |