Search notes:
Oracle SQL Plan operation FIRST ROW
The
plan operation FIRST ROW
has exactly one child row source which is either
create table tq84_tab (
id integer not null,
txt varchar2(10) not null,
val number(4,1) not null,
--
constraint tq84_tab_pk primary key (id, txt)
);
insert into tq84_tab
select
mod(level, 100),
dbms_random.string('U', 2) || '.' || trunc((level-1)/100),
dbms_random.value(1, 999)
from
dual connect by level <= 10000;
begin
dbms_stats.gather_table_stats(user, 'tq84_tab');
end;
/
explain plan for
select
max(txt)
from
tq84_tab
where
id = 10
;
select * from table(dbms_xplan.display(format=>'basic'));
--
-- ----------------------------------------------------
-- | Id | Operation | Name |
-- ----------------------------------------------------
-- | 0 | SELECT STATEMENT | |
-- | 1 | SORT AGGREGATE | |
-- | 2 | FIRST ROW | |
-- | 3 | INDEX RANGE SCAN (MIN/MAX)| TQ84_TAB_PK |
-- ----------------------------------------------------
drop table tq84_tab;