Search notes:

Oracle SQL Plan operation INDEX FULL SCAN (MIN/MAX)

create table tq84_tab (
   id     varchar2(10) not null,
   val    number(4,1)  not null,
   --
   constraint tq84_tab_pk primary key (id)
);


insert into tq84_tab
select
   dbms_random.string('U', 2) || '.' || to_char(level, 'fm99999'),
   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(id)
from
   tq84_tab
;
select * from table(dbms_xplan.display(format=>'basic'));
--
-- --------------------------------------------------
-- | Id  | Operation                  | Name        |
-- --------------------------------------------------
-- |   0 | SELECT STATEMENT           |             |
-- |   1 |  SORT AGGREGATE            |             |
-- |   2 |   INDEX FULL SCAN (MIN/MAX)| TQ84_TAB_PK |
-- --------------------------------------------------

drop table tq84_tab;

See also

The SQL plan operation INDEX FULL SCAN

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758199313, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/databases/Oracle/SQL/statement/execution/plan/operations/index_/full-scan/min-max/index(73): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78