充分

无论是否可以使用索引,FULL 提示都会告诉 Oracle 对指定的表执行全表扫描。

create table fullTable(id) as select level from dual connect by level < 100000;
create index idx on fullTable(id);

没有提示,使用索引:

select count(1) from fullTable f where id between 10 and 100;| Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     ||   0 | SELECT STATEMENT  |      |     1 |    13 |     3   (0)| 00:00:01 |
|   1 |  SORT AGGREGATE   |      |     1 |    13 |            |          |
|*  2 |   INDEX RANGE SCAN| IDX  |     2 |    26 |     3   (0)| 00:00:01 |```

完整提示强制完整扫描:

``` placeholder
select /*+ `full(f)` */ `count(1)` from fullTable f where id between 10 and 100;| Id  | Operation          | Name      | Rows  | Bytes | Cost (%CPU)| Time     ||   0 | SELECT STATEMENT   |           |     1 |    13 |    47   (3)| 00:00:01 |
|   1 |  SORT AGGREGATE    |           |     1 |    13 |            |          |
|*  2 |   TABLE ACCESS FULL| FULLTABLE |     2 |    26 |    47   (3)| 00:00:01 |```