您的位置:首页 > 其它

index range scan和index fast full scan

2014-11-07 08:38 344 查看
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 |
---------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

2 - access("OBJECT_ID">170000)

Note
-----
- dynamic sampling used for this statement

Statistics
----------------------------------------------------------
0  recursive calls
0  db block gets
25  consistent gets
0  physical reads
0  redo size
516  bytes sent via SQL*Net to client
492  bytes received via SQL*Net from client
2  SQL*Net roundtrips to/from client
0  sorts (memory)
0  sorts (disk)
1  rows processed

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 |	5 |   133   (1)| 00:00:02 |
|   1 |  SORT AGGREGATE   |	  |	1 |	5 |	       |	  |
|*  2 |   INDEX RANGE SCAN| IDX_1 | 55470 |   270K|   133   (1)| 00:00:02 |
---------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

2 - access("OBJECT_ID">170000)

Statistics
----------------------------------------------------------
1  recursive calls
0  db block gets
25  consistent gets
0  physical reads
0  redo size
516  bytes sent via SQL*Net to client
492  bytes received via SQL*Net from client
2  SQL*Net roundtrips to/from client
0  sorts (memory)
0  sorts (disk)
1  rows processed

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

Execution Plan
----------------------------------------------------------
Plan hash value: 1271403589

-------------------------------------------------------------------------------
| Id  | Operation	      | Name  | Rows  | Bytes | Cost (%CPU)| Time     |
-------------------------------------------------------------------------------
|   0 | SELECT STATEMENT      |       |     1 |     5 |   865	(3)| 00:00:11 |
|   1 |  SORT AGGREGATE       |       |     1 |     5 | 	   |	      |
|*  2 |   INDEX FAST FULL SCAN| IDX_1 |  1648K|  8048K|   865	(3)| 00:00:11 |
-------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

2 - filter("OBJECT_ID">1)

Statistics
----------------------------------------------------------
1  recursive calls
0  db block gets
3652  consistent gets
522  physical reads
0  redo size
518  bytes sent via SQL*Net to client
492  bytes received via SQL*Net from client
2  SQL*Net roundtrips to/from client
0  sorts (memory)
0  sorts (disk)
1  rows processed

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 |	5 |   133   (1)| 00:00:02 |
|   1 |  SORT AGGREGATE   |	  |	1 |	5 |	       |	  |
|*  2 |   INDEX RANGE SCAN| IDX_1 | 55502 |   271K|   133   (1)| 00:00:02 |
---------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

2 - access("OBJECT_ID">=170000)

Statistics
----------------------------------------------------------
1  recursive calls
0  db block gets
25  consistent gets
0  physical reads
0  redo size
516  bytes sent via SQL*Net to client
492  bytes received via SQL*Net from client
2  SQL*Net roundtrips to/from client
0  sorts (memory)
0  sorts (disk)
1  rows processed
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: