index range scan和index fast full scan

SQL> create index idx_1 on t1(object_id);

Index created.

SQL> set linesie 200
SP2-0158: unknown SET option "linesie"
SQL> select max(object_id) from t1;

MAX(OBJECT_ID)
--------------
	175920

SQL> select count(*) from t1 where object_id>170000;

  COUNT(*)
----------
      9696

SQL> set autot trace
SQL> select count(*) from t1 where object_id>170000;


Execution Plan
----------------------------------------------------------
Plan hash value: 3018594191

---------------------------------------------------------------------------
| Id  | Operation	  | Name  | Rows  | Bytes | Cost (%CPU)| Time	  |
---------------------------------------------------------------------------
|   0 | SELECT STATEMENT  |	  |	1 |    13 |    40   (0)| 00:00:01 |
|   1 |  SORT AGGREGATE   |	  |	1 |    13 |	       |	  |
|*  2 |   INDEX RANGE SCAN| IDX_1 | 20427 |   259K|    40   (0)| 00:00:01 |
------------------------------------------------------------

你可能感兴趣的:(sql,查询优化)