Search notes:

Oracle SQL Plan operation COLLECTION ITERATOR PICKLER FETCH

The collection iterator pickler fetch plan operator (row source) is used to fetch data («rows») from a table function (the object type for this operator is always PROCEDURE).
create type tq84_rec
   authid definer
as object
(
   col_one   number,
   col_two   varchar2(20)
);
/

create type tq84_tab as table of tq84_rec;
/

create function tq84_f return tq84_tab
   authid definer
as begin

    return tq84_tab(
       tq84_rec(42, 'forty-two'  ),
       tq84_rec( 1, 'one'        ),
       tq84_rec(99, 'ninety-nine')
    );

end tq84_f;
/

explain plan for
   select * from table(tq84_f);

select * from table(dbms_xplan.display(format=>'basic +rows,bytes'));
--
-- --------------------------------------------------------------------
-- | Id  | Operation                         | Name   | Rows  | Bytes |
-- --------------------------------------------------------------------
-- |   0 | SELECT STATEMENT                  |        |  8168 | 16336 |
-- |   1 |  COLLECTION ITERATOR PICKLER FETCH| TQ84_F |  8168 | 16336 |
-- --------------------------------------------------------------------

--
--  ==> As can be seen, by default, the COLLECTION ITERATOR
--      PICKLER FETCH operator expects 8168 rows / 16336 bytes.
--
--      The number of expected rows can be tweaked with the
--      OPT_ESTIMATE hint (which supersedes the CARDINALITY hint):
--
explain plan for
   select /*+ opt_estimate(table t rows=3) */
      *
   from
      table(tq84_f) t;

select * from table(dbms_xplan.display(format=>'basic +rows,bytes'));
--
-- --------------------------------------------------------------------
-- | Id  | Operation                         | Name   | Rows  | Bytes |
-- --------------------------------------------------------------------
-- |   0 | SELECT STATEMENT                  |        |     3 |     6 |
-- |   1 |  COLLECTION ITERATOR PICKLER FETCH| TQ84_F |     3 |     6 |
-- --------------------------------------------------------------------


drop function tq84_f;
drop type     tq84_tab;
drop type     tq84_rec;

See also

The rowsource COLLECTION ITERATOR PICKLER FETCH is also created for the xmlTable function.
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...', 1759421479, '216.73.216.42', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/databases/Oracle/SQL/statement/execution/plan/operations/collection-iterator/pickler-fetch/index(104): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78