Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles
New Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 

 

PL/SQL fetches data 8x faster than SQL

PL/SQL Bulk Collect speed is amazing and many companies need to justify the expense of changing their PL/SQL code.

The best overall reference of hypercharging PL/SQL with bulk collect and forall array collections is Dr. Tim Hall (Oracle ACE of the year 2006) and his landmark book "Oracle PL/SQL Tuning: Expert Secrets for High Performance Programming".

Kent Crotty, author of Easy Oracle Application Express (HTML-DB) conducted a study to prove the speed of the PL/SQL bulk collect over vanilla SQL with cursor fetches:

DECLARE
TYPE prod_tab IS TABLE OF products%ROWTYPE;
products_tab           prod_tab := prod_tab();
start_time             number;
end_time               number;
CURSOR products_data IS SELECT * FROM products;
BEGIN
start_time := DBMS_UTILITY.get_time;
OPEN products_data;
LOOP
               products_tab.extend;
          FETCH products_data INTO products_tab(products_tab.last);
               IF products_data%NOTFOUND THEN
        products_tab.delete(products_tab.last);
                  EXIT;
          END IF;
END LOOP;
CLOSE products_data;
end_time := DBMS_UTILITY.get_time;
DBMS_OUTPUT.PUT_LINE(‘Conventional (‘||products_tab.count||’): ’||to_char(end_time-start_time));
 
Start_time := DBMS_UTILITY.get_time;
OPEN products_data;
FETCH products_data BULK COLLECT INTO products_tab;
CLOSE products_data; 
end_time := DBMS_UTILITY.get_time;
DBMS_OUTPUT.PUT_LINE(‘Bulk Collect (‘||products_tab.count||’): ’||to_char(end_time-start_time));
END;

Crotty's test shows an amazing speed improvement when compared to standard PL/SQL, with the bulk collect running 8x faster:

SQL> /
Conventional (100000): 117
Bulk Collect (100000): 14

Here are some related notes on this great technology:



 

 
 
��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster
 
 
 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2017

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.

Remote Emergency Support provided by Conversational