Search notes:

Oracle SQL Plan operation TABLE ACCESS BY [LOCAL|GLOBAL] INDEX ROWID [BATCHED]

TABLE ACCESS BY LOCAL INDEX ROWID BATCHED

create table tq84_tab (
   dt  date         not null,
   id  integer      not null,
   nm  number(2)    not null,
   tx  varchar2(10) not null
)
partition by range
  (dt) interval (numtoyminterval(1, 'YEAR'))
  (partition p_1 values less than (date '2000-01-01'))
;

begin
   dbms_random.seed(42);
end;
/

insert into tq84_tab
select
   trunc(sysdate - dbms_random.value(1, 10000)),
   level,
   dbms_random.value(0,99),
   dbms_random.string('a', 10)
from
   dual connect by level <= 10000;

create index tq84_tab_ix on tq84_tab(dt, nm) local;

begin
   dbms_stats.gather_table_stats(user, 'tq84_tab');
end;
/

explain plan for
select *
from
   tq84_tab
where
   dt  between sysdate -30 and sysdate and
   nm = 77;

select * from table(dbms_xplan.display(format=>'basic predicate'));
--
-- -------------------------------------------------------------------
-- | Id  | Operation                                   | Name        |
-- -------------------------------------------------------------------
-- |   0 | SELECT STATEMENT                            |             |
-- |*  1 |  FILTER                                     |             |
-- |   2 |   PARTITION RANGE ITERATOR                  |             |
-- |   3 |    TABLE ACCESS BY LOCAL INDEX ROWID BATCHED| TQ84_TAB    |
-- |*  4 |     INDEX RANGE SCAN                        | TQ84_TAB_IX |
-- -------------------------------------------------------------------
--  
-- Predicate Information (identified by operation id):
-- ---------------------------------------------------
--  
--    1 - filter(SYSDATE@!>=SYSDATE@!-30)
--    4 - access("DT">=SYSDATE@!-30 AND "NM"=77 AND "DT"<=SYSDATE@!)
--        filter("NM"=77)

drop table tq84_tab;

See also

SQL statement execution plan operations

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...', 1758199316, '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/table-access/by-index/global-local/index(97): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78