索引唯一性扫描(INDEX UNIQUE SCAN)

 

     索引唯一性扫描(INDEX UNIQUE SCAN)是针对唯一性索引(UNIQUE INDEX)的扫描,它仅仅适用于where条件里是等值查询的目标SQL。因为扫描的对象是唯一性索引,所以索引唯一性扫描的结果至多只会返回一条记录。

Emp表中empno为primary key,对应一个unique index


SCOTT@PDBORCL> select * from emp where empno=7369;


执行计划
----------------------------------------------------------
Plan hash value: 2949544139

--------------------------------------------------------------------------------------
| Id  | Operation                   | Name   | Rows  | Bytes | Cost (%CPU)| Time     |
--------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT            |        |     1 |    38 |     1   (0)| 00:00:01 |
|   1 |  TABLE ACCESS BY INDEX ROWID| EMP    |     1 |    38 |     1   (0)| 00:00:01 |
|*  2 |   INDEX UNIQUE SCAN         | PK_EMP |     1 |       |     0   (0)| 00:00:01 |
--------------------------------------------------------------------------------------

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

   2 - access("EMPNO"=7369)


统计信息
----------------------------------------------------------
         69  recursive calls
          0  db block gets
         95  consistent gets
         21  physical reads
          0  redo size
        898  bytes sent via SQL*Net to client
        533  bytes received via SQL*Net from client
          1  SQL*Net roundtrips to/from client
          8  sorts (memory)
          0  sorts (disk)
          1  rows processed

SCOTT@PDBORCL>

View Code

image

从上述显示内容可以看出,"select * from emp where empno=7369"的执行计划走的是索引唯一性扫描

posted on 2015-04-28 23:05  小强斋太  阅读(6909)  评论(0编辑  收藏  举报

导航