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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
| SQL> create table myobjects as select * from all_objects;
Table created.
SQL> create index myindex on myobjects(object_id);
Index created.
SQL> exec dbms_stats.gather_table_stats(user,'MYOBJECTS');
PL/SQL procedure successfully completed.
SQL> explain plan for select * from myobjects where object_id != 10;
Explained.
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
-----------------------------------------------------------------------------
--------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost |
--------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 70857 | 6158K| 58 |
|* 1 | TABLE ACCESS FULL | MYOBJECTS | 70857 | 6158K| 58 |
--------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("MYOBJECTS"."OBJECT_ID"<>10)
Note: cpu costing is off
14 rows selected.
SQL> explain plan for select * from myobjects where object_id < 10;
Explained.
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
-----------------------------------------------------------------------------
---------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost |
---------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 3 | 267 | 3 |
| 1 | TABLE ACCESS BY INDEX ROWID| MYOBJECTS | 3 | 267 | 3 |
|* 2 | INDEX RANGE SCAN | MYINDEX | 3 | | 2 |
---------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("MYOBJECTS"."OBJECT_ID"<10)
Note: cpu costing is off
15 rows selected.
SQL> |