SlideShare a Scribd company logo
Developers Toolbox - Coding
 Can collections speed up your PL/SQL?




Patrick Barel    , AMIS, The Netherlands

Wednesday, June 27, 2012
ODTUG KScope 12
San Antonio, Texas, USA
Agenda

 Records
 Collections
 Bulk Processing
 Table Functions
Record
Records

Table
View
Cursor}
User Defined
             %rowtype
Records

           Record type definition

                                                                  ,
TYPE     record_type   IS    RECORD   (     field_definition           )   ;




           Field definition
                       NOT     NULL
                                            :=
                                                          expression
                                          DEFAULT
 field   datatype
Collections

 Three types available
  PL/SQL Tables
  Index by Tables
  Associative Arrays
Collections

 Three types available
  Associative Arrays
  Nested Tables
  Varrays
Collections

 Three types available
  Associative Arrays  PL/SQL Only
  Nested Tables        SQL and PL/SQL
  Varrays              SQL and PL/SQL
PL/SQL Collections (3 Types)

 Associative Arrays
 Varrays
 Nested Tables
About Associative Arrays


Number of elements is unbounded, practically speaking.
 Valid row numbers range from -231+1 to 231-1.
   (i.e. -2,147,483,647 to 2,147,483,647)
   This range allows you to employ the row number as an intelligent key,
   such as the primary key or unique index value, because…
AAs also:
Can be sparse.
  Data does not have to be stored in consecutive rows, as is required in
   traditional 3GL arrays and VARRAYs.
Can have index values of integers or strings (Oracle9i R2
 and above).
                                                         assoc_array_example.sql
                                                         collection_of_records.sql
                                                          count_vs_rowcount.sql
Associative Arrays


Name Changes:
  7: PL/SQL Tables
  8i: Index By Tables
  9i: Associative Arrays
Single dimensioned, unbounded, sparse collection of
 homogeneous elements
PL/SQL Only
                                      key     value
Methods

                    idx := emp_t.first;
                    idx := emp_t.last;
                    idx := emp_t.next (idx);
                    idx := emp_t.prior (idx);
First              idx := emp_t.count;
Last               if emp_t.exists (idx)
                    then
Next (n)              ...
Prior (n)          end if;
Count              emp_t.delete (1);
Exists (n)         emp_t.delete (2, 4);
                    emp_t.delete;
Delete [(n[,m])]
Associative Array
declare
  type num_tbl is table of number
    index by binary_integer;
  l_num_tbl num_tbl;                key   value
  l_idx     integer;
begin
  ...
Associative Array
declare
  type num_tbl is table of number
    index by binary_integer;
  l_num_tbl num_tbl;                key   value
  l_idx     integer;
begin                               1      12
  l_num_tbl(1):= 12;                54     5
  l_num_tbl(54):= 5;
  ...
Associative Array
declare
  type num_tbl is table of number
    index by binary_integer;
  l_num_tbl num_tbl;                key   value
  l_idx     integer;
begin                               1      12
  l_num_tbl(1):= 12;                3      98
  l_num_tbl(54):= 5;
  l_num_tbl(3):= 98;                5      3
  l_num_tbl(5):= l_num_tbl.count;
  l_idx:= l_num_tbl.first;          54     5
  ...
end;
Associative Array
declare
  type num_tbl is table of number
    index by binary_integer;
  l_num_tbl num_tbl;                              key   value
  l_idx     integer;
begin                                        2
                                                  1      12
  l_num_tbl(1):= 12;                              3      98
  l_num_tbl(54):= 5;
  l_num_tbl(3):= 98;                              5      3
  l_num_tbl(5):= l_num_tbl.count;
                                             10
  l_idx:= l_num_tbl.first;                        54     5
  loop
   dbms_output.put_line(l_num_tbl(l_idx));
    l_idx:= l_num_tbl.next(l_idx);
    exit when l_idx is null;
  end loop;
                                                  key   value
  l_num_tbl.delete(2,10);                         1      12
  dbms_output.put_line(l_num_tbl.count);
end;                                              54     5
Associative Array VARCHAR2 Key
declare
  type str_tbl is table of varchar2(40)
    index by varchar2(40);
  l_str_tbl str_tbl;                      key   value
  l_idx     varchar2(40);
begin
  ...
Associative Array VARCHAR2 Key
declare
  type str_tbl is table of varchar2(40)
    index by varchar2(40);
  l_str_tbl str_tbl;                      key   value
  l_idx     varchar2(40);
begin                                     one   een
  l_str_tbl('one'):= 'een';               two   twee
  l_str_tbl('two'):= 'twee';
  ...
Associative Array VARCHAR2 Key
declare
  type str_tbl is table of varchar2(40)
    index by varchar2(40);
  l_str_tbl str_tbl;                      key     value
  l_idx     varchar2(40);
begin                                     four    vier
  l_str_tbl('one'):= 'een';               one     een
  l_str_tbl('two'):= 'twee';
  l_str_tbl('three'):= 'drie';            three   drie
  l_str_tbl('four'):= 'vier';
  l_idx:= l_str_tbl.first;                two     twee
  ...
end;
Associative Array VARCHAR2 Key
declare
  type str_tbl is table of varchar2(40)
    index by varchar2(40);
  l_str_tbl str_tbl;                              key     value
  l_idx     varchar2(40);
begin                                             four    vier
  l_str_tbl('one'):= ‘een';                  o
                                                  one     een
  l_str_tbl('two'):= ‘twee';
  l_str_tbl('three'):= 'drie';                    three   drie
  l_str_tbl('four'):= 'vier';                tr
  l_idx:= l_str_tbl.first;                        two     twee
  loop
   dbms_output.put_line(l_str_tbl(l_idx));
    l_idx:= l_str_tbl.next(l_idx);
                                                  key     value
    exit when l_idx is null;
  end loop;                                       four    vier
  l_str_tbl.delete('o', 'tr');
  dbms_output.put_line(l_str_tbl.count);          two     twee
end;
Retrieval
for idx in emp_t.first .. emp_t.last
loop                                   • Dense
   ...                                 • Count > 0
end loop;

for idx in 1 .. emp_t.count
loop
                                       • Dense
   ...
end loop;

idx := emp_t.first;
while idx is not null
loop
                                       •…
   ...
   idx := emp_t.next (idx);
end loop;
PL/SQL Collections (3 Types)

 Associative Arrays
 Varrays
 Nested Tables
About Varrays


Has a maximum size, associated with its type.
  Can adjust the size in Oracle10g R2.
Part of object model, requiring initialization.
Is always dense; you can only remove elements
 from the end of a varray.
Can be defined as a schema level type and used
 as a relational table column type.




                                             varray_example.sql
Varray


Single dimensioned, always bounded, never
 sparse collection of homogeneous elements
SQL and PL/SQL
Can be used as column datatype in a table
Stored “in-line” in same table
Retains its ordering                  key   value
Needs to be initialized and extended
Methods



First
Last
                    idx := ename_t.limit;
Next (n)           ename_t.extend (1);
Prior (n)          ename_t.trim (1);
Count              ename_t.trim;
Exists (n)
Delete
Limit
Extend [(n[,m])]
Trim [(n)]
Using Varray
declare
   type ename_vt is varray (10) of varchar2(10);
   ename_t ename_vt;
begin                       Initialization
   ename_t := ename_vt();
   ename_t.extend (1);
   ename_t(1) := 'Spencer';
   ...
end;

declare
   type ename_vt is varray (10) of varchar2(10);
   ename_t ename_vt := ename_vt ('Davis');
begin
   ...
end;                        Initialization and
                                Extending
How Variable is the Varray?




Pre 10gR2: VARRAY needed to be recreated.

10gr2 and up: ALTER TYPE MODIFY LIMIT
  Only to increase the limit




                                             varraylimit.sql
PL/SQL Collections (3 Types)

 Associative Arrays
 Varrays
 Nested Tables
About Nested Tables



Name reflects fact that this collection can be
 "nested" inside relational table as a column.
Type can be defined at schema level.
No practical, pre-defined limit on a nested table.
 Valid row numbers range from 1 to 231-1.
  (i.e. 1 to 2,147,483,647)
Part of object model, requiring initialization.
Is always dense initially, but can become sparse
 after deletes.



                                              nested_table_example.sql
Nested Tables


Single dimensioned, unbounded, sparse collection
 of homogeneous elements
SQL and PL/SQL
Can be used as column datatype in a table
Stored “out-of-line” in a separate table
Initially dense, can be sparse
                                    key      value
Methods



First
Last
Next (n)
Prior (n)
Count
Exists (n)
Delete [(n[,m])]
Extend [(n[,m])]
Trim
(Limit)
Using Nested Tables
declare
   type ename_nt is table of varchar2(10);
   ename_t ename_nt;
begin                     Initialization
   ename_t := ename_nt();
   ename_t.extend (1);
   ename_t(1) := 'Spencer';
   ...
end;

declare
   type ename_nt is table of varchar2(10);
   ename_t ename_nt := ename_nt ('Davis');
begin
   ...
end;                       Initialization and
                               Extending
Differences


Feature            Associative Array   Nested Table        VArray
SQL – PL/SQL       PL/SQL only         SQL and PL/SQL      SQL and PL/SQL
Dense - Sparse     Sparse              Initially Dense     Dense
                                       Can become sparse
Size               ‘Unlimited’         ‘Unlimited’         Limited
Order              Unordered           Unordered           Ordered
Usage              Any set of data     Any set of data     Small sets of data
Use in Table       No                  Yes                 Yes
Bulk Processing in PL/SQL


 FORALL
  Use with inserts, updates and deletes.
  Move data from collections to tables.
 BULK COLLECT
  Use with implicit and explicit queries.
  Move data from tables into collections.
 In both cases, the "back back" end processing in the
  SQL engine is unchanged.
  Same transaction and rollback segment management
  Same number of individual SQL statements will be
    executed.
  But BEFORE and AFTER statement-level triggers only
    fire once per FORALL INSERT statements.


                                        statement_trigger_and_forall.sql
BULK COLLECT for multi-row querying

       SELECT * BULK COLLECT INTO collection FROM table;

       FETCH cur BULK COLLECT INTO collection;


Fetch one or more rows into a collection.
Collection is always filled sequentially from index value 1.

Query does not raise NO_DATA_FOUND if no rows are
 fetched.

  Instead, the collection is empty.

Use FETCH with LIMIT to manage memory.
BULK COLLECT for multi-row querying

       SELECT * BULK COLLECT INTO collection FROM table;

       FETCH cur BULK COLLECT INTO collection;


Fetch one or more rows into a collection.
Collection is always filled sequentially from index value 1.

Query does not raise NO_DATA_FOUND if no rows are
 fetched.

  Instead, the collection is empty.

Use FETCH with LIMIT to manage memory.
Limiting retrieval with BULK COLLECT



  If you are certain that your table will never have
   more than N rows, use a VARRAY (N) to hold the
   fetched data.
   If that limit is exceeded, Oracle will raise an
      error.
  If you do not know in advance how many rows
   you might retrieve, you should:
   Declare an explicit cursor.
   Fetch BULK COLLECT with the LIMIT clause.
Details on that LIMIT clause




 The limit value can be a literal or a variable.
  Use a variable for the limit to give you
    maximum flexibility.
 With very large volumes of data and small
  numbers of batch processes, however, a larger
  LIMIT could help.
Terminating loops containing BULK COLLECT

  LOOP
     FETCH my_cursor BULK COLLECT INTO l_collection LIMIT 100;
     EXIT WHEN my_cursor%NOTFOUND;   BAD IDEA



    You will need to break the habit of checking
     %NOTFOUND right after the fetch.
     You might skip processing some of your data.
    Instead, do one of the following:
     At the end of the loop, check %NOTFOUND.
     Right after fetch, exit when collection.COUNT = 0.
     At end of loop, exit when collection.COUNT < limit.



                                                             bulklimit_stop.sql
When to convert to BULK COLLECT


 Prior to Oracle10g, you should convert all multiple row
  fetch logic, including cursor for loops, to BULK
  COLLECTs.
 For Oracle10g and above, leave your cursor for loops in
  place if they...
  contain no DML operations.
  seem to be running fast enough.
 Explicit BULK COLLECTs will usually run faster than
  cursor for loops optimized to Bulk Collect.
Use FORALL for multi-row DML operations
    PROCEDURE upd_for_dept (...) IS
    BEGIN
       FORALL indx IN low_value .. high_value
          UPDATE employee
             SET salary = newsal_in
           WHERE employee_id = list_of_emps (indx);
    END;
                                Binding array




 Convert loops that contain inserts, updates or deletes to
  FORALL statements.
 Header looks identical to a numeric FOR loop.
   Implicitly declared integer iterator
   At least one "bind array" that uses this iterator as its
    index value.
More on FORALL

 Use any type of collection with FORALL.
 One DML statement is allowed per FORALL.
  Each FORALL is its own "extended" DML statement.
 The collection must be indexed by integer.
 The binding array must be sequentially filled.
  Unless you use the INDICES OF or VALUES OF clause.
 SQL%ROWCOUNT returns total number of rows modified
  by entire FORALL.
  Unreliable when used with LOG ERRORS.
 Use the SQL%BULK_ROWCOUNT cursor attribute to
  determine how many rows are modified by each
  statement.


                                                bulktiming.sql
                                              bulk_rowcount.sql
FORALL and collections of records




Prior to 11g, you cannot reference a field of a record in
 FORALL.
You must instead break data into separate collections, or...
You can also perform record-level inserts and updates.
In 11g, this restriction is lifted (but it is an undocumented
 feature).
 http://technology.amis.nl/blog/2367/implementation-restricted-relaxed-in-oracle-11g




                                                                                        11g_field_of_record.sql
INDICES OF and VALUES OF



Prior to Oracle10g R2, the binding arrays in a FORALL
 statement must be sequentially filled.
Now, however, you can bind sparse collections by using
 INDICES OF and VALUES OF in the FORALL header.
   PROCEDURE upd_for_dept (...) IS
   BEGIN
      FORALL indx IN INDICES OF list_of_emps
         UPDATE employee
            SET salary = newsal_in
          WHERE employee_id = list_of_emps (indx);



                                                     10g_indices_of*.sql
                                                     10g_values_of*.sql
Exception handling and FORALL

 When an exception occurs in a DML statement....
  That statement is rolled back and the FORALL stops.
  All (previous) successful statements are not rolled
    back.
 Use the SAVE EXCEPTIONS clause to tell Oracle to
  continue past exceptions, and save the error information
  for later.
 Then check the contents of the pseudo-collection of
  records, SQL%BULK_EXCEPTIONS.
  Two fields: ERROR_INDEX and ERROR_CODE
Converting old-fashioned code to bulk


                          slow-by-slow
  Change from integrated, row-by-row approach to
   a phased approach.
  Phase 1: get the data with BULK COLLECT.
   Filling those collections
  Phase 2: massage collections so they are ready
   for DML operations.
  Phase 3: push the data to the database with
   FORALL.

                                              cfl_to_bulk_0.sql
                                              cfl_to_bulk_5.sql
                                              10g_indices_of.sql
                                              10g_values_of.sql
Bulk Processing Conclusions


 Most important performance tuning feature in PL/SQL.
  Almost always the fastest way to execute multi-row
    SQL operations in PL/SQL.
 You trade off increased complexity of code for
  dramatically faster execution.
  But in Oracle Database 10g and above, the compiler
    will automatically optimize cursor FOR loops to
    BULK COLLECT efficiency.
  No need to convert unless the loop contains DML or
    you want to maximally optimize your code.
 Watch out for the impact on PGA memory!
Row by row processing of data in PL/SQL
Oracle server

          PL/SQL Runtime Engine               SQL Engine

        PL/SQL block
                           Procedural
                           statement
  OPEN cur;                 executor
  FETCH cur INTO rec;                             SQL
  WHILE cur%found LOOP                         statement
    <<Do Stuff>>
                                               executor
    FETCH cur INTO rec;
  END LOOP;
  CLOSE cur;



                              Performance penalty
                              for many “context
                              switches”

                                                     © Steven Feuerstein/Patrick Barel
Bulk processing with BULK COLLECT
Oracle server

          PL/SQL Runtime Engine                   SQL Engine

        PL/SQL block
                             Procedural
  OPEN cur;                  statement
  FETCH cur
   BULK COLLECT INTO col;
                              executor
                                                         SQL
  FOR indx IN
    col.first .. col.last
                                                      statement
      LOOP                                            executor
    <<Do Stuff>>
  END LOOP;
         Row
  CLOSE cur;                                           Row
         Row                                           Row
         Row                                           Row
         Row                                           Row
         Row                                           Row
         Row                Fewer context switches,    Row
                            same SQL behavior
                                                             © Steven Feuerstein/Patrick Barel
Row by row processing of DML in PL/SQL
Oracle server

          PL/SQL Runtime Engine                 SQL Engine

        PL/SQL block
                              Procedural
                              statement
  FOR rec IN emp_cur LOOP      executor
    UPDATE employee                                 SQL
       SET salary = ...                          statement
     WHERE employee_id =
                                                 executor
           rec.employee_id;
  END LOOP;




                                Performance penalty
                                for many “context
                                switches”

                                                             © Steven Feuerstein
Bulk processing with FORALL
Oracle server

          PL/SQL Runtime Engine                       SQL Engine

        PL/SQL block
                                 Procedural
  FORALL indx IN                 statement
         list_of_emps.FIRST..
         list_of_emps.LAST
                                  executor
                                                             SQL
   UPDATE employee
      SET salary = ...
                                                          statement
    WHERE employee_id =                                   executor
          list_of_emps(indx);

         Update...                                         Update...
         Update...                                         Update...
         Update...                                         Update...
         Update...                                         Update...
         Update...                                         Update...
         Update...              Fewer context switches,    Update...
                                same SQL behavior
                                                                       © Steven Feuerstein
Table Functions

Table functions are functions that produce
        a collection of rows
(either a nested table or a varray)
that can be queried like a physical database table.
You use a table function like the name of a
database table, in the FROM clause of a query.
Table Functions

Table functions are based on collections
Must be available in the SQL layer
Nested tables and Varray
Table Functions

 Create a function in PL/SQL
 Make sure it returns a collection
 Query it using the TABLE() operator
 Table functions can be pipelined
  (return results as they are produced)
 Table functions can be paralellized
Table Functions

You can use Table Functions when
 Calculations cannot (easily) be done in SQL
 You want to take advantage of PL/SQL e.g.
  caching or package variables
 You want to leverage the power of PL/SQL in
  SQL
 Make your views more dynamic
Resources
Online
tahiti.oracle.com
  For all documentation online
 www.allthingsoracle.com
   o   http://allthingsoracle.com/collections-in-oracle-pt-1/
   o   http://allthingsoracle.com/collections-in-oracle-part-2/
   o   http://allthingsoracle.com/bulk-processing-in-oracle-part-1/
   o   http://allthingsoracle.com/bulk-processing-in-oracle-part-2/

Books
Oracle PL/SQL Programming
  Chapter 12 (collections) and
    chapter 21 (bulk processing)
 Oracle PL/SQL for DBAs
  Chapter 1 (collections and bulk processing)
AMIS - Can collections speed up your PL/SQL?

More Related Content

What's hot

Estructura de Datos: Pila
Estructura de Datos: PilaEstructura de Datos: Pila
Estructura de Datos: Pila
Emerson Garay
 
Segundo reinado
Segundo reinadoSegundo reinado
Segundo reinado
Fabiana Tonsis
 
Ideologias do século XIX
Ideologias do século XIXIdeologias do século XIX
Data Visualization Techniques in Power BI
Data Visualization Techniques in Power BIData Visualization Techniques in Power BI
Data Visualization Techniques in Power BI
Angel Abundez
 
Lec8 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Dynamic Sch...
Lec8 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Dynamic Sch...Lec8 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Dynamic Sch...
Lec8 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Dynamic Sch...
Hsien-Hsin Sean Lee, Ph.D.
 
El SIG en el Canal de Isabel II
El SIG en el Canal de Isabel IIEl SIG en el Canal de Isabel II
El SIG en el Canal de Isabel II
Esri
 

What's hot (6)

Estructura de Datos: Pila
Estructura de Datos: PilaEstructura de Datos: Pila
Estructura de Datos: Pila
 
Segundo reinado
Segundo reinadoSegundo reinado
Segundo reinado
 
Ideologias do século XIX
Ideologias do século XIXIdeologias do século XIX
Ideologias do século XIX
 
Data Visualization Techniques in Power BI
Data Visualization Techniques in Power BIData Visualization Techniques in Power BI
Data Visualization Techniques in Power BI
 
Lec8 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Dynamic Sch...
Lec8 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Dynamic Sch...Lec8 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Dynamic Sch...
Lec8 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Dynamic Sch...
 
El SIG en el Canal de Isabel II
El SIG en el Canal de Isabel IIEl SIG en el Canal de Isabel II
El SIG en el Canal de Isabel II
 

Viewers also liked

Oracle - SQL-PL/SQL context switching
Oracle - SQL-PL/SQL context switchingOracle - SQL-PL/SQL context switching
Oracle - SQL-PL/SQL context switching
Smitha Padmanabhan
 
APEX Developers : Do More With LESS !
APEX Developers : Do More With LESS !APEX Developers : Do More With LESS !
APEX Developers : Do More With LESS !
Roel Hartman
 
Troubleshooting APEX Performance Issues
Troubleshooting APEX Performance IssuesTroubleshooting APEX Performance Issues
Troubleshooting APEX Performance Issues
Roel Hartman
 
Oracle query optimizer
Oracle query optimizerOracle query optimizer
Oracle query optimizer
Smitha Padmanabhan
 
LOBS, BLOBS, CLOBS: Dealing with Attachments in APEX
LOBS, BLOBS, CLOBS: Dealing with Attachments in APEXLOBS, BLOBS, CLOBS: Dealing with Attachments in APEX
LOBS, BLOBS, CLOBS: Dealing with Attachments in APEX
Enkitec
 
Automated testing APEX Applications
Automated testing APEX ApplicationsAutomated testing APEX Applications
Automated testing APEX Applications
Roel Hartman
 
The Amazing and Elegant PL/SQL Function Result Cache
The Amazing and Elegant PL/SQL Function Result CacheThe Amazing and Elegant PL/SQL Function Result Cache
The Amazing and Elegant PL/SQL Function Result Cache
Steven Feuerstein
 
PLSQL Standards and Best Practices
PLSQL Standards and Best PracticesPLSQL Standards and Best Practices
PLSQL Standards and Best Practices
Alwyn D'Souza
 
Generic collection types in PLSQL
Generic collection types in PLSQLGeneric collection types in PLSQL
Generic collection types in PLSQL
Arnold Reuser
 
Striving for Perfection: The Ultimate APEX Application Architecture
Striving for Perfection: The Ultimate APEX Application ArchitectureStriving for Perfection: The Ultimate APEX Application Architecture
Striving for Perfection: The Ultimate APEX Application Architecture
Roel Hartman
 
Oracle Text in APEX
Oracle Text in APEXOracle Text in APEX
Oracle Text in APEX
Scott Wesley
 
Oracle PL/SQL exception handling
Oracle PL/SQL exception handlingOracle PL/SQL exception handling
Oracle PL/SQL exception handling
Smitha Padmanabhan
 
Oracle SQL, PL/SQL Performance tuning
Oracle SQL, PL/SQL Performance tuningOracle SQL, PL/SQL Performance tuning
Oracle SQL, PL/SQL Performance tuning
Smitha Padmanabhan
 
utPLSQL: Unit Testing for Oracle PL/SQL
utPLSQL: Unit Testing for Oracle PL/SQLutPLSQL: Unit Testing for Oracle PL/SQL
utPLSQL: Unit Testing for Oracle PL/SQL
Steven Feuerstein
 
Oracle APEX Performance
Oracle APEX PerformanceOracle APEX Performance
Oracle APEX Performance
Scott Wesley
 
Oracle SQL, PL/SQL best practices
Oracle SQL, PL/SQL best practicesOracle SQL, PL/SQL best practices
Oracle SQL, PL/SQL best practices
Smitha Padmanabhan
 
Oracle PL/SQL Bulk binds
Oracle PL/SQL Bulk bindsOracle PL/SQL Bulk binds
Oracle PL/SQL Bulk binds
Scott Wesley
 
My Top 5 APEX JavaScript API's
My Top 5 APEX JavaScript API'sMy Top 5 APEX JavaScript API's
My Top 5 APEX JavaScript API's
Roel Hartman
 
Turbocharge SQL Performance in PL/SQL with Bulk Processing
Turbocharge SQL Performance in PL/SQL with Bulk ProcessingTurbocharge SQL Performance in PL/SQL with Bulk Processing
Turbocharge SQL Performance in PL/SQL with Bulk Processing
Steven Feuerstein
 
Impact Analysis with PL/Scope
Impact Analysis with PL/ScopeImpact Analysis with PL/Scope
Impact Analysis with PL/Scope
Steven Feuerstein
 

Viewers also liked (20)

Oracle - SQL-PL/SQL context switching
Oracle - SQL-PL/SQL context switchingOracle - SQL-PL/SQL context switching
Oracle - SQL-PL/SQL context switching
 
APEX Developers : Do More With LESS !
APEX Developers : Do More With LESS !APEX Developers : Do More With LESS !
APEX Developers : Do More With LESS !
 
Troubleshooting APEX Performance Issues
Troubleshooting APEX Performance IssuesTroubleshooting APEX Performance Issues
Troubleshooting APEX Performance Issues
 
Oracle query optimizer
Oracle query optimizerOracle query optimizer
Oracle query optimizer
 
LOBS, BLOBS, CLOBS: Dealing with Attachments in APEX
LOBS, BLOBS, CLOBS: Dealing with Attachments in APEXLOBS, BLOBS, CLOBS: Dealing with Attachments in APEX
LOBS, BLOBS, CLOBS: Dealing with Attachments in APEX
 
Automated testing APEX Applications
Automated testing APEX ApplicationsAutomated testing APEX Applications
Automated testing APEX Applications
 
The Amazing and Elegant PL/SQL Function Result Cache
The Amazing and Elegant PL/SQL Function Result CacheThe Amazing and Elegant PL/SQL Function Result Cache
The Amazing and Elegant PL/SQL Function Result Cache
 
PLSQL Standards and Best Practices
PLSQL Standards and Best PracticesPLSQL Standards and Best Practices
PLSQL Standards and Best Practices
 
Generic collection types in PLSQL
Generic collection types in PLSQLGeneric collection types in PLSQL
Generic collection types in PLSQL
 
Striving for Perfection: The Ultimate APEX Application Architecture
Striving for Perfection: The Ultimate APEX Application ArchitectureStriving for Perfection: The Ultimate APEX Application Architecture
Striving for Perfection: The Ultimate APEX Application Architecture
 
Oracle Text in APEX
Oracle Text in APEXOracle Text in APEX
Oracle Text in APEX
 
Oracle PL/SQL exception handling
Oracle PL/SQL exception handlingOracle PL/SQL exception handling
Oracle PL/SQL exception handling
 
Oracle SQL, PL/SQL Performance tuning
Oracle SQL, PL/SQL Performance tuningOracle SQL, PL/SQL Performance tuning
Oracle SQL, PL/SQL Performance tuning
 
utPLSQL: Unit Testing for Oracle PL/SQL
utPLSQL: Unit Testing for Oracle PL/SQLutPLSQL: Unit Testing for Oracle PL/SQL
utPLSQL: Unit Testing for Oracle PL/SQL
 
Oracle APEX Performance
Oracle APEX PerformanceOracle APEX Performance
Oracle APEX Performance
 
Oracle SQL, PL/SQL best practices
Oracle SQL, PL/SQL best practicesOracle SQL, PL/SQL best practices
Oracle SQL, PL/SQL best practices
 
Oracle PL/SQL Bulk binds
Oracle PL/SQL Bulk bindsOracle PL/SQL Bulk binds
Oracle PL/SQL Bulk binds
 
My Top 5 APEX JavaScript API's
My Top 5 APEX JavaScript API'sMy Top 5 APEX JavaScript API's
My Top 5 APEX JavaScript API's
 
Turbocharge SQL Performance in PL/SQL with Bulk Processing
Turbocharge SQL Performance in PL/SQL with Bulk ProcessingTurbocharge SQL Performance in PL/SQL with Bulk Processing
Turbocharge SQL Performance in PL/SQL with Bulk Processing
 
Impact Analysis with PL/Scope
Impact Analysis with PL/ScopeImpact Analysis with PL/Scope
Impact Analysis with PL/Scope
 

Similar to AMIS - Can collections speed up your PL/SQL?

Arrays
ArraysArrays
C (PPS)Programming for problem solving.pptx
C (PPS)Programming for problem solving.pptxC (PPS)Programming for problem solving.pptx
C (PPS)Programming for problem solving.pptx
rohinitalekar1
 
Unit3 C
Unit3 C Unit3 C
Unit3 C
arnold 7490
 
Arrays 1D and 2D , and multi dimensional
Arrays 1D and 2D , and multi dimensional Arrays 1D and 2D , and multi dimensional
Arrays 1D and 2D , and multi dimensional
Appili Vamsi Krishna
 
Lec 25 - arrays-strings
Lec 25 - arrays-stringsLec 25 - arrays-strings
Lec 25 - arrays-strings
Princess Sam
 
ReviewArrays.ppt
ReviewArrays.pptReviewArrays.ppt
ReviewArrays.ppt
AliAhmad38278
 
Introduction to Arrays in C
Introduction to Arrays in CIntroduction to Arrays in C
Introduction to Arrays in C
Thesis Scientist Private Limited
 
Homework Assignment – Array Technical DocumentWrite a technical .pdf
Homework Assignment – Array Technical DocumentWrite a technical .pdfHomework Assignment – Array Technical DocumentWrite a technical .pdf
Homework Assignment – Array Technical DocumentWrite a technical .pdf
aroraopticals15
 
Algo>Arrays
Algo>ArraysAlgo>Arrays
Algo>Arrays
Ain-ul-Moiz Khawaja
 
Array&amp;string
Array&amp;stringArray&amp;string
Array&amp;string
chanchal ghosh
 
Unit4 Slides
Unit4 SlidesUnit4 Slides
Unit4 Slides
Rakesh Roshan
 
Unit 2
Unit 2Unit 2
Unit 2
Sowri Rajan
 
array-191103180006.pdf
array-191103180006.pdfarray-191103180006.pdf
array-191103180006.pdf
HEMAHEMS5
 
Array Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional arrayArray Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional array
imtiazalijoono
 
Arrays in Data Structure and Algorithm
Arrays in Data Structure and Algorithm Arrays in Data Structure and Algorithm
Arrays in Data Structure and Algorithm
KristinaBorooah
 
Array assignment
Array assignmentArray assignment
Array assignment
Ahmad Kamal
 
Data structure.pptx
Data structure.pptxData structure.pptx
Data structure.pptx
SajalFayyaz
 
DDL and DML statements.pptx
DDL and DML statements.pptxDDL and DML statements.pptx
DDL and DML statements.pptx
Karthick Panneerselvam
 
Session 4
Session 4Session 4
Lecture 7
Lecture 7Lecture 7
Lecture 7
Mohammed Khan
 

Similar to AMIS - Can collections speed up your PL/SQL? (20)

Arrays
ArraysArrays
Arrays
 
C (PPS)Programming for problem solving.pptx
C (PPS)Programming for problem solving.pptxC (PPS)Programming for problem solving.pptx
C (PPS)Programming for problem solving.pptx
 
Unit3 C
Unit3 C Unit3 C
Unit3 C
 
Arrays 1D and 2D , and multi dimensional
Arrays 1D and 2D , and multi dimensional Arrays 1D and 2D , and multi dimensional
Arrays 1D and 2D , and multi dimensional
 
Lec 25 - arrays-strings
Lec 25 - arrays-stringsLec 25 - arrays-strings
Lec 25 - arrays-strings
 
ReviewArrays.ppt
ReviewArrays.pptReviewArrays.ppt
ReviewArrays.ppt
 
Introduction to Arrays in C
Introduction to Arrays in CIntroduction to Arrays in C
Introduction to Arrays in C
 
Homework Assignment – Array Technical DocumentWrite a technical .pdf
Homework Assignment – Array Technical DocumentWrite a technical .pdfHomework Assignment – Array Technical DocumentWrite a technical .pdf
Homework Assignment – Array Technical DocumentWrite a technical .pdf
 
Algo>Arrays
Algo>ArraysAlgo>Arrays
Algo>Arrays
 
Array&amp;string
Array&amp;stringArray&amp;string
Array&amp;string
 
Unit4 Slides
Unit4 SlidesUnit4 Slides
Unit4 Slides
 
Unit 2
Unit 2Unit 2
Unit 2
 
array-191103180006.pdf
array-191103180006.pdfarray-191103180006.pdf
array-191103180006.pdf
 
Array Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional arrayArray Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional array
 
Arrays in Data Structure and Algorithm
Arrays in Data Structure and Algorithm Arrays in Data Structure and Algorithm
Arrays in Data Structure and Algorithm
 
Array assignment
Array assignmentArray assignment
Array assignment
 
Data structure.pptx
Data structure.pptxData structure.pptx
Data structure.pptx
 
DDL and DML statements.pptx
DDL and DML statements.pptxDDL and DML statements.pptx
DDL and DML statements.pptx
 
Session 4
Session 4Session 4
Session 4
 
Lecture 7
Lecture 7Lecture 7
Lecture 7
 

More from Getting value from IoT, Integration and Data Analytics

AMIS Oracle OpenWorld en Code One Review 2018 - Blockchain, Integration, Serv...
AMIS Oracle OpenWorld en Code One Review 2018 - Blockchain, Integration, Serv...AMIS Oracle OpenWorld en Code One Review 2018 - Blockchain, Integration, Serv...
AMIS Oracle OpenWorld en Code One Review 2018 - Blockchain, Integration, Serv...
Getting value from IoT, Integration and Data Analytics
 
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 2: Custom Application ...
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 2: Custom Application ...AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 2: Custom Application ...
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 2: Custom Application ...
Getting value from IoT, Integration and Data Analytics
 
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 2: SaaS
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 2: SaaSAMIS Oracle OpenWorld en Code One Review 2018 - Pillar 2: SaaS
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 2: SaaS
Getting value from IoT, Integration and Data Analytics
 
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 1: Data
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 1: DataAMIS Oracle OpenWorld en Code One Review 2018 - Pillar 1: Data
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 1: Data
Getting value from IoT, Integration and Data Analytics
 
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 1: Cloud Infrastructure
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 1: Cloud Infrastructure AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 1: Cloud Infrastructure
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 1: Cloud Infrastructure
Getting value from IoT, Integration and Data Analytics
 
10 tips voor verbetering in je Linkedin profiel
10 tips voor verbetering in je Linkedin profiel10 tips voor verbetering in je Linkedin profiel
10 tips voor verbetering in je Linkedin profiel
Getting value from IoT, Integration and Data Analytics
 
Iot in de zorg the next step - fit for purpose
Iot in de zorg   the next step - fit for purpose Iot in de zorg   the next step - fit for purpose
Iot in de zorg the next step - fit for purpose
Getting value from IoT, Integration and Data Analytics
 
Iot overview .. Best practices and lessons learned by Conclusion Conenct
Iot overview .. Best practices and lessons learned by Conclusion Conenct Iot overview .. Best practices and lessons learned by Conclusion Conenct
Iot overview .. Best practices and lessons learned by Conclusion Conenct
Getting value from IoT, Integration and Data Analytics
 
IoT Fit for purpose - how to be successful in IOT Conclusion Connect
IoT Fit for purpose - how to be successful in IOT Conclusion Connect IoT Fit for purpose - how to be successful in IOT Conclusion Connect
IoT Fit for purpose - how to be successful in IOT Conclusion Connect
Getting value from IoT, Integration and Data Analytics
 
Industry and IOT Overview of protocols and best practices Conclusion Connect
Industry and IOT Overview of protocols and best practices  Conclusion ConnectIndustry and IOT Overview of protocols and best practices  Conclusion Connect
Industry and IOT Overview of protocols and best practices Conclusion Connect
Getting value from IoT, Integration and Data Analytics
 
IoT practical case using the people counter sensing traffic density build usi...
IoT practical case using the people counter sensing traffic density build usi...IoT practical case using the people counter sensing traffic density build usi...
IoT practical case using the people counter sensing traffic density build usi...
Getting value from IoT, Integration and Data Analytics
 
R introduction decision_trees
R introduction decision_treesR introduction decision_trees
Introduction overviewmachinelearning sig Door Lucas Jellema
Introduction overviewmachinelearning sig Door Lucas JellemaIntroduction overviewmachinelearning sig Door Lucas Jellema
Introduction overviewmachinelearning sig Door Lucas Jellema
Getting value from IoT, Integration and Data Analytics
 
IoT and the Future of work
IoT and the Future of work IoT and the Future of work
Oracle OpenWorld 2017 Review (31st October 2017 - 250 slides)
Oracle OpenWorld 2017 Review (31st October 2017 - 250 slides)Oracle OpenWorld 2017 Review (31st October 2017 - 250 slides)
Oracle OpenWorld 2017 Review (31st October 2017 - 250 slides)
Getting value from IoT, Integration and Data Analytics
 
Ethereum smart contracts - door Peter Reitsma
Ethereum smart contracts - door Peter ReitsmaEthereum smart contracts - door Peter Reitsma
Ethereum smart contracts - door Peter Reitsma
Getting value from IoT, Integration and Data Analytics
 
Blockchain - Techniek en usecases door Robert van Molken - AMIS - Conclusion
Blockchain - Techniek en usecases door Robert van Molken - AMIS - ConclusionBlockchain - Techniek en usecases door Robert van Molken - AMIS - Conclusion
Blockchain - Techniek en usecases door Robert van Molken - AMIS - Conclusion
Getting value from IoT, Integration and Data Analytics
 
kennissessie blockchain - Wat is Blockchain en smart contracts @Conclusion
kennissessie blockchain -  Wat is Blockchain en smart contracts @Conclusion kennissessie blockchain -  Wat is Blockchain en smart contracts @Conclusion
kennissessie blockchain - Wat is Blockchain en smart contracts @Conclusion
Getting value from IoT, Integration and Data Analytics
 
Internet of Things propositie - Enterprise IOT - AMIS - Conclusion
Internet of Things propositie - Enterprise IOT - AMIS - Conclusion Internet of Things propositie - Enterprise IOT - AMIS - Conclusion
Internet of Things propositie - Enterprise IOT - AMIS - Conclusion
Getting value from IoT, Integration and Data Analytics
 
Omc AMIS evenement 26012017 Dennis van Soest
Omc AMIS evenement 26012017 Dennis van SoestOmc AMIS evenement 26012017 Dennis van Soest
Omc AMIS evenement 26012017 Dennis van Soest
Getting value from IoT, Integration and Data Analytics
 

More from Getting value from IoT, Integration and Data Analytics (20)

AMIS Oracle OpenWorld en Code One Review 2018 - Blockchain, Integration, Serv...
AMIS Oracle OpenWorld en Code One Review 2018 - Blockchain, Integration, Serv...AMIS Oracle OpenWorld en Code One Review 2018 - Blockchain, Integration, Serv...
AMIS Oracle OpenWorld en Code One Review 2018 - Blockchain, Integration, Serv...
 
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 2: Custom Application ...
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 2: Custom Application ...AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 2: Custom Application ...
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 2: Custom Application ...
 
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 2: SaaS
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 2: SaaSAMIS Oracle OpenWorld en Code One Review 2018 - Pillar 2: SaaS
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 2: SaaS
 
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 1: Data
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 1: DataAMIS Oracle OpenWorld en Code One Review 2018 - Pillar 1: Data
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 1: Data
 
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 1: Cloud Infrastructure
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 1: Cloud Infrastructure AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 1: Cloud Infrastructure
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 1: Cloud Infrastructure
 
10 tips voor verbetering in je Linkedin profiel
10 tips voor verbetering in je Linkedin profiel10 tips voor verbetering in je Linkedin profiel
10 tips voor verbetering in je Linkedin profiel
 
Iot in de zorg the next step - fit for purpose
Iot in de zorg   the next step - fit for purpose Iot in de zorg   the next step - fit for purpose
Iot in de zorg the next step - fit for purpose
 
Iot overview .. Best practices and lessons learned by Conclusion Conenct
Iot overview .. Best practices and lessons learned by Conclusion Conenct Iot overview .. Best practices and lessons learned by Conclusion Conenct
Iot overview .. Best practices and lessons learned by Conclusion Conenct
 
IoT Fit for purpose - how to be successful in IOT Conclusion Connect
IoT Fit for purpose - how to be successful in IOT Conclusion Connect IoT Fit for purpose - how to be successful in IOT Conclusion Connect
IoT Fit for purpose - how to be successful in IOT Conclusion Connect
 
Industry and IOT Overview of protocols and best practices Conclusion Connect
Industry and IOT Overview of protocols and best practices  Conclusion ConnectIndustry and IOT Overview of protocols and best practices  Conclusion Connect
Industry and IOT Overview of protocols and best practices Conclusion Connect
 
IoT practical case using the people counter sensing traffic density build usi...
IoT practical case using the people counter sensing traffic density build usi...IoT practical case using the people counter sensing traffic density build usi...
IoT practical case using the people counter sensing traffic density build usi...
 
R introduction decision_trees
R introduction decision_treesR introduction decision_trees
R introduction decision_trees
 
Introduction overviewmachinelearning sig Door Lucas Jellema
Introduction overviewmachinelearning sig Door Lucas JellemaIntroduction overviewmachinelearning sig Door Lucas Jellema
Introduction overviewmachinelearning sig Door Lucas Jellema
 
IoT and the Future of work
IoT and the Future of work IoT and the Future of work
IoT and the Future of work
 
Oracle OpenWorld 2017 Review (31st October 2017 - 250 slides)
Oracle OpenWorld 2017 Review (31st October 2017 - 250 slides)Oracle OpenWorld 2017 Review (31st October 2017 - 250 slides)
Oracle OpenWorld 2017 Review (31st October 2017 - 250 slides)
 
Ethereum smart contracts - door Peter Reitsma
Ethereum smart contracts - door Peter ReitsmaEthereum smart contracts - door Peter Reitsma
Ethereum smart contracts - door Peter Reitsma
 
Blockchain - Techniek en usecases door Robert van Molken - AMIS - Conclusion
Blockchain - Techniek en usecases door Robert van Molken - AMIS - ConclusionBlockchain - Techniek en usecases door Robert van Molken - AMIS - Conclusion
Blockchain - Techniek en usecases door Robert van Molken - AMIS - Conclusion
 
kennissessie blockchain - Wat is Blockchain en smart contracts @Conclusion
kennissessie blockchain -  Wat is Blockchain en smart contracts @Conclusion kennissessie blockchain -  Wat is Blockchain en smart contracts @Conclusion
kennissessie blockchain - Wat is Blockchain en smart contracts @Conclusion
 
Internet of Things propositie - Enterprise IOT - AMIS - Conclusion
Internet of Things propositie - Enterprise IOT - AMIS - Conclusion Internet of Things propositie - Enterprise IOT - AMIS - Conclusion
Internet of Things propositie - Enterprise IOT - AMIS - Conclusion
 
Omc AMIS evenement 26012017 Dennis van Soest
Omc AMIS evenement 26012017 Dennis van SoestOmc AMIS evenement 26012017 Dennis van Soest
Omc AMIS evenement 26012017 Dennis van Soest
 

Recently uploaded

Demystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through StorytellingDemystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through Storytelling
Enterprise Knowledge
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
Fwdays
 
High performance Serverless Java on AWS- GoTo Amsterdam 2024
High performance Serverless Java on AWS- GoTo Amsterdam 2024High performance Serverless Java on AWS- GoTo Amsterdam 2024
High performance Serverless Java on AWS- GoTo Amsterdam 2024
Vadym Kazulkin
 
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsConnector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
DianaGray10
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
DianaGray10
 
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
saastr
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
Miro Wengner
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
 
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham HillinQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
LizaNolte
 
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin..."$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
Fwdays
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
AstuteBusiness
 
Session 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdfSession 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdf
UiPathCommunity
 
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansBiomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Neo4j
 
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Pitangent Analytics & Technology Solutions Pvt. Ltd
 
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
Fwdays
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
Neo4j
 

Recently uploaded (20)

Demystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through StorytellingDemystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through Storytelling
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
 
High performance Serverless Java on AWS- GoTo Amsterdam 2024
High performance Serverless Java on AWS- GoTo Amsterdam 2024High performance Serverless Java on AWS- GoTo Amsterdam 2024
High performance Serverless Java on AWS- GoTo Amsterdam 2024
 
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsConnector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
 
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
 
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham HillinQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
 
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin..."$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
 
Session 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdfSession 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdf
 
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansBiomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
 
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
 
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
 

AMIS - Can collections speed up your PL/SQL?

  • 1. Developers Toolbox - Coding Can collections speed up your PL/SQL? Patrick Barel , AMIS, The Netherlands Wednesday, June 27, 2012 ODTUG KScope 12 San Antonio, Texas, USA
  • 2. Agenda  Records  Collections  Bulk Processing  Table Functions
  • 5. Records  Record type definition , TYPE record_type IS RECORD ( field_definition ) ;  Field definition NOT NULL := expression DEFAULT field datatype
  • 6. Collections  Three types available  PL/SQL Tables  Index by Tables  Associative Arrays
  • 7. Collections  Three types available  Associative Arrays  Nested Tables  Varrays
  • 8. Collections  Three types available  Associative Arrays  PL/SQL Only  Nested Tables  SQL and PL/SQL  Varrays  SQL and PL/SQL
  • 9. PL/SQL Collections (3 Types)  Associative Arrays  Varrays  Nested Tables
  • 10. About Associative Arrays Number of elements is unbounded, practically speaking. Valid row numbers range from -231+1 to 231-1. (i.e. -2,147,483,647 to 2,147,483,647) This range allows you to employ the row number as an intelligent key, such as the primary key or unique index value, because… AAs also: Can be sparse.  Data does not have to be stored in consecutive rows, as is required in traditional 3GL arrays and VARRAYs. Can have index values of integers or strings (Oracle9i R2 and above). assoc_array_example.sql collection_of_records.sql count_vs_rowcount.sql
  • 11. Associative Arrays Name Changes:  7: PL/SQL Tables  8i: Index By Tables  9i: Associative Arrays Single dimensioned, unbounded, sparse collection of homogeneous elements PL/SQL Only key value
  • 12. Methods idx := emp_t.first; idx := emp_t.last; idx := emp_t.next (idx); idx := emp_t.prior (idx); First idx := emp_t.count; Last if emp_t.exists (idx) then Next (n) ... Prior (n) end if; Count emp_t.delete (1); Exists (n) emp_t.delete (2, 4); emp_t.delete; Delete [(n[,m])]
  • 13. Associative Array declare type num_tbl is table of number index by binary_integer; l_num_tbl num_tbl; key value l_idx integer; begin ...
  • 14. Associative Array declare type num_tbl is table of number index by binary_integer; l_num_tbl num_tbl; key value l_idx integer; begin 1 12 l_num_tbl(1):= 12; 54 5 l_num_tbl(54):= 5; ...
  • 15. Associative Array declare type num_tbl is table of number index by binary_integer; l_num_tbl num_tbl; key value l_idx integer; begin 1 12 l_num_tbl(1):= 12; 3 98 l_num_tbl(54):= 5; l_num_tbl(3):= 98; 5 3 l_num_tbl(5):= l_num_tbl.count; l_idx:= l_num_tbl.first; 54 5 ... end;
  • 16. Associative Array declare type num_tbl is table of number index by binary_integer; l_num_tbl num_tbl; key value l_idx integer; begin 2 1 12 l_num_tbl(1):= 12; 3 98 l_num_tbl(54):= 5; l_num_tbl(3):= 98; 5 3 l_num_tbl(5):= l_num_tbl.count; 10 l_idx:= l_num_tbl.first; 54 5 loop dbms_output.put_line(l_num_tbl(l_idx)); l_idx:= l_num_tbl.next(l_idx); exit when l_idx is null; end loop; key value l_num_tbl.delete(2,10); 1 12 dbms_output.put_line(l_num_tbl.count); end; 54 5
  • 17. Associative Array VARCHAR2 Key declare type str_tbl is table of varchar2(40) index by varchar2(40); l_str_tbl str_tbl; key value l_idx varchar2(40); begin ...
  • 18. Associative Array VARCHAR2 Key declare type str_tbl is table of varchar2(40) index by varchar2(40); l_str_tbl str_tbl; key value l_idx varchar2(40); begin one een l_str_tbl('one'):= 'een'; two twee l_str_tbl('two'):= 'twee'; ...
  • 19. Associative Array VARCHAR2 Key declare type str_tbl is table of varchar2(40) index by varchar2(40); l_str_tbl str_tbl; key value l_idx varchar2(40); begin four vier l_str_tbl('one'):= 'een'; one een l_str_tbl('two'):= 'twee'; l_str_tbl('three'):= 'drie'; three drie l_str_tbl('four'):= 'vier'; l_idx:= l_str_tbl.first; two twee ... end;
  • 20. Associative Array VARCHAR2 Key declare type str_tbl is table of varchar2(40) index by varchar2(40); l_str_tbl str_tbl; key value l_idx varchar2(40); begin four vier l_str_tbl('one'):= ‘een'; o one een l_str_tbl('two'):= ‘twee'; l_str_tbl('three'):= 'drie'; three drie l_str_tbl('four'):= 'vier'; tr l_idx:= l_str_tbl.first; two twee loop dbms_output.put_line(l_str_tbl(l_idx)); l_idx:= l_str_tbl.next(l_idx); key value exit when l_idx is null; end loop; four vier l_str_tbl.delete('o', 'tr'); dbms_output.put_line(l_str_tbl.count); two twee end;
  • 21. Retrieval for idx in emp_t.first .. emp_t.last loop • Dense ... • Count > 0 end loop; for idx in 1 .. emp_t.count loop • Dense ... end loop; idx := emp_t.first; while idx is not null loop •… ... idx := emp_t.next (idx); end loop;
  • 22. PL/SQL Collections (3 Types)  Associative Arrays  Varrays  Nested Tables
  • 23. About Varrays Has a maximum size, associated with its type.  Can adjust the size in Oracle10g R2. Part of object model, requiring initialization. Is always dense; you can only remove elements from the end of a varray. Can be defined as a schema level type and used as a relational table column type. varray_example.sql
  • 24. Varray Single dimensioned, always bounded, never sparse collection of homogeneous elements SQL and PL/SQL Can be used as column datatype in a table Stored “in-line” in same table Retains its ordering key value Needs to be initialized and extended
  • 25. Methods First Last idx := ename_t.limit; Next (n) ename_t.extend (1); Prior (n) ename_t.trim (1); Count ename_t.trim; Exists (n) Delete Limit Extend [(n[,m])] Trim [(n)]
  • 26. Using Varray declare type ename_vt is varray (10) of varchar2(10); ename_t ename_vt; begin Initialization ename_t := ename_vt(); ename_t.extend (1); ename_t(1) := 'Spencer'; ... end; declare type ename_vt is varray (10) of varchar2(10); ename_t ename_vt := ename_vt ('Davis'); begin ... end; Initialization and Extending
  • 27. How Variable is the Varray? Pre 10gR2: VARRAY needed to be recreated. 10gr2 and up: ALTER TYPE MODIFY LIMIT  Only to increase the limit varraylimit.sql
  • 28. PL/SQL Collections (3 Types)  Associative Arrays  Varrays  Nested Tables
  • 29. About Nested Tables Name reflects fact that this collection can be "nested" inside relational table as a column. Type can be defined at schema level. No practical, pre-defined limit on a nested table.  Valid row numbers range from 1 to 231-1. (i.e. 1 to 2,147,483,647) Part of object model, requiring initialization. Is always dense initially, but can become sparse after deletes. nested_table_example.sql
  • 30. Nested Tables Single dimensioned, unbounded, sparse collection of homogeneous elements SQL and PL/SQL Can be used as column datatype in a table Stored “out-of-line” in a separate table Initially dense, can be sparse key value
  • 31. Methods First Last Next (n) Prior (n) Count Exists (n) Delete [(n[,m])] Extend [(n[,m])] Trim (Limit)
  • 32. Using Nested Tables declare type ename_nt is table of varchar2(10); ename_t ename_nt; begin Initialization ename_t := ename_nt(); ename_t.extend (1); ename_t(1) := 'Spencer'; ... end; declare type ename_nt is table of varchar2(10); ename_t ename_nt := ename_nt ('Davis'); begin ... end; Initialization and Extending
  • 33. Differences Feature Associative Array Nested Table VArray SQL – PL/SQL PL/SQL only SQL and PL/SQL SQL and PL/SQL Dense - Sparse Sparse Initially Dense Dense Can become sparse Size ‘Unlimited’ ‘Unlimited’ Limited Order Unordered Unordered Ordered Usage Any set of data Any set of data Small sets of data Use in Table No Yes Yes
  • 34. Bulk Processing in PL/SQL  FORALL  Use with inserts, updates and deletes.  Move data from collections to tables.  BULK COLLECT  Use with implicit and explicit queries.  Move data from tables into collections.  In both cases, the "back back" end processing in the SQL engine is unchanged.  Same transaction and rollback segment management  Same number of individual SQL statements will be executed.  But BEFORE and AFTER statement-level triggers only fire once per FORALL INSERT statements. statement_trigger_and_forall.sql
  • 35. BULK COLLECT for multi-row querying SELECT * BULK COLLECT INTO collection FROM table; FETCH cur BULK COLLECT INTO collection; Fetch one or more rows into a collection. Collection is always filled sequentially from index value 1. Query does not raise NO_DATA_FOUND if no rows are fetched. Instead, the collection is empty. Use FETCH with LIMIT to manage memory.
  • 36. BULK COLLECT for multi-row querying SELECT * BULK COLLECT INTO collection FROM table; FETCH cur BULK COLLECT INTO collection; Fetch one or more rows into a collection. Collection is always filled sequentially from index value 1. Query does not raise NO_DATA_FOUND if no rows are fetched. Instead, the collection is empty. Use FETCH with LIMIT to manage memory.
  • 37. Limiting retrieval with BULK COLLECT  If you are certain that your table will never have more than N rows, use a VARRAY (N) to hold the fetched data.  If that limit is exceeded, Oracle will raise an error.  If you do not know in advance how many rows you might retrieve, you should:  Declare an explicit cursor.  Fetch BULK COLLECT with the LIMIT clause.
  • 38. Details on that LIMIT clause  The limit value can be a literal or a variable.  Use a variable for the limit to give you maximum flexibility.  With very large volumes of data and small numbers of batch processes, however, a larger LIMIT could help.
  • 39. Terminating loops containing BULK COLLECT LOOP FETCH my_cursor BULK COLLECT INTO l_collection LIMIT 100; EXIT WHEN my_cursor%NOTFOUND; BAD IDEA  You will need to break the habit of checking %NOTFOUND right after the fetch.  You might skip processing some of your data.  Instead, do one of the following:  At the end of the loop, check %NOTFOUND.  Right after fetch, exit when collection.COUNT = 0.  At end of loop, exit when collection.COUNT < limit. bulklimit_stop.sql
  • 40. When to convert to BULK COLLECT  Prior to Oracle10g, you should convert all multiple row fetch logic, including cursor for loops, to BULK COLLECTs.  For Oracle10g and above, leave your cursor for loops in place if they...  contain no DML operations.  seem to be running fast enough.  Explicit BULK COLLECTs will usually run faster than cursor for loops optimized to Bulk Collect.
  • 41. Use FORALL for multi-row DML operations PROCEDURE upd_for_dept (...) IS BEGIN FORALL indx IN low_value .. high_value UPDATE employee SET salary = newsal_in WHERE employee_id = list_of_emps (indx); END; Binding array Convert loops that contain inserts, updates or deletes to FORALL statements. Header looks identical to a numeric FOR loop.  Implicitly declared integer iterator  At least one "bind array" that uses this iterator as its index value.
  • 42. More on FORALL  Use any type of collection with FORALL.  One DML statement is allowed per FORALL.  Each FORALL is its own "extended" DML statement.  The collection must be indexed by integer.  The binding array must be sequentially filled.  Unless you use the INDICES OF or VALUES OF clause.  SQL%ROWCOUNT returns total number of rows modified by entire FORALL.  Unreliable when used with LOG ERRORS.  Use the SQL%BULK_ROWCOUNT cursor attribute to determine how many rows are modified by each statement. bulktiming.sql bulk_rowcount.sql
  • 43. FORALL and collections of records Prior to 11g, you cannot reference a field of a record in FORALL. You must instead break data into separate collections, or... You can also perform record-level inserts and updates. In 11g, this restriction is lifted (but it is an undocumented feature).  http://technology.amis.nl/blog/2367/implementation-restricted-relaxed-in-oracle-11g 11g_field_of_record.sql
  • 44. INDICES OF and VALUES OF Prior to Oracle10g R2, the binding arrays in a FORALL statement must be sequentially filled. Now, however, you can bind sparse collections by using INDICES OF and VALUES OF in the FORALL header. PROCEDURE upd_for_dept (...) IS BEGIN FORALL indx IN INDICES OF list_of_emps UPDATE employee SET salary = newsal_in WHERE employee_id = list_of_emps (indx); 10g_indices_of*.sql 10g_values_of*.sql
  • 45. Exception handling and FORALL  When an exception occurs in a DML statement....  That statement is rolled back and the FORALL stops.  All (previous) successful statements are not rolled back.  Use the SAVE EXCEPTIONS clause to tell Oracle to continue past exceptions, and save the error information for later.  Then check the contents of the pseudo-collection of records, SQL%BULK_EXCEPTIONS.  Two fields: ERROR_INDEX and ERROR_CODE
  • 46. Converting old-fashioned code to bulk slow-by-slow  Change from integrated, row-by-row approach to a phased approach.  Phase 1: get the data with BULK COLLECT.  Filling those collections  Phase 2: massage collections so they are ready for DML operations.  Phase 3: push the data to the database with FORALL. cfl_to_bulk_0.sql cfl_to_bulk_5.sql 10g_indices_of.sql 10g_values_of.sql
  • 47. Bulk Processing Conclusions  Most important performance tuning feature in PL/SQL.  Almost always the fastest way to execute multi-row SQL operations in PL/SQL.  You trade off increased complexity of code for dramatically faster execution.  But in Oracle Database 10g and above, the compiler will automatically optimize cursor FOR loops to BULK COLLECT efficiency.  No need to convert unless the loop contains DML or you want to maximally optimize your code.  Watch out for the impact on PGA memory!
  • 48.
  • 49. Row by row processing of data in PL/SQL Oracle server PL/SQL Runtime Engine SQL Engine PL/SQL block Procedural statement OPEN cur; executor FETCH cur INTO rec; SQL WHILE cur%found LOOP statement <<Do Stuff>> executor FETCH cur INTO rec; END LOOP; CLOSE cur; Performance penalty for many “context switches” © Steven Feuerstein/Patrick Barel
  • 50. Bulk processing with BULK COLLECT Oracle server PL/SQL Runtime Engine SQL Engine PL/SQL block Procedural OPEN cur; statement FETCH cur BULK COLLECT INTO col; executor SQL FOR indx IN col.first .. col.last statement LOOP executor <<Do Stuff>> END LOOP; Row CLOSE cur; Row Row Row Row Row Row Row Row Row Row Fewer context switches, Row same SQL behavior © Steven Feuerstein/Patrick Barel
  • 51. Row by row processing of DML in PL/SQL Oracle server PL/SQL Runtime Engine SQL Engine PL/SQL block Procedural statement FOR rec IN emp_cur LOOP executor UPDATE employee SQL SET salary = ... statement WHERE employee_id = executor rec.employee_id; END LOOP; Performance penalty for many “context switches” © Steven Feuerstein
  • 52. Bulk processing with FORALL Oracle server PL/SQL Runtime Engine SQL Engine PL/SQL block Procedural FORALL indx IN statement list_of_emps.FIRST.. list_of_emps.LAST executor SQL UPDATE employee SET salary = ... statement WHERE employee_id = executor list_of_emps(indx); Update... Update... Update... Update... Update... Update... Update... Update... Update... Update... Update... Fewer context switches, Update... same SQL behavior © Steven Feuerstein
  • 53. Table Functions Table functions are functions that produce a collection of rows (either a nested table or a varray) that can be queried like a physical database table. You use a table function like the name of a database table, in the FROM clause of a query.
  • 54. Table Functions Table functions are based on collections Must be available in the SQL layer Nested tables and Varray
  • 55. Table Functions  Create a function in PL/SQL  Make sure it returns a collection  Query it using the TABLE() operator  Table functions can be pipelined (return results as they are produced)  Table functions can be paralellized
  • 56. Table Functions You can use Table Functions when  Calculations cannot (easily) be done in SQL  You want to take advantage of PL/SQL e.g. caching or package variables  You want to leverage the power of PL/SQL in SQL  Make your views more dynamic
  • 57. Resources Online tahiti.oracle.com  For all documentation online  www.allthingsoracle.com o http://allthingsoracle.com/collections-in-oracle-pt-1/ o http://allthingsoracle.com/collections-in-oracle-part-2/ o http://allthingsoracle.com/bulk-processing-in-oracle-part-1/ o http://allthingsoracle.com/bulk-processing-in-oracle-part-2/ Books Oracle PL/SQL Programming  Chapter 12 (collections) and chapter 21 (bulk processing)  Oracle PL/SQL for DBAs  Chapter 1 (collections and bulk processing)