SlideShare a Scribd company logo
Author: Duy Tran
Minh Doan
10, April 2012
4/2/2014 1
Objective
This slide provides practices which worth
considered in coding PL/SQL. You should have
your senior reviewed or evaluated them before
using in production code.
4/2/2014 2
Agenda
A. Practices
1. Select MIN and MAX
2. COUNT(*), COUNT(1) or COUNT(PK) ?
3. NOT IN vs MINUS
4. Ignored hints
5. Nested Loop is not good ?
6. Full table scans and Parallel hints
7. NOT IN and NOT EXISTS as outer joins
8. Correlated Subqueries Using EXISTS clause
9. Selecting many rows, unbounded result set
10. Selecting many rows, bounded result set
11. Selecting single row
B. Resources
C. Q/A
4/2/2014 3
A. Practices
1. Select MIN and MAX
2. COUNT(*), COUNT(1) or COUNT(PK) ?
3. NOT IN vs MINUS
4. Ignored hints
5. Nested Loop is not good ?
6. Full table scans and Parallel hints
7. NOT IN and NOT EXISTS as outer joins
8. Correlated Subqueries Using EXISTS clause
9. Selecting many rows, unbounded result set
10. Selecting many rows, bounded result set
11. Selecting single row
4/2/2014
A. Practices 4
1. Select MIN and MAX
We have table TEST with 100000 rows.
 SELECT COUNT(id) FROM test;
Execution plan: INDEX FAST FULL SCAN| T_PK with 215 consistent gets
 SELECT MAX(id) FROM test;
Execution plan: INDEX FULL SCAN (MIN/MAX)| T_PK with 2 consistent gets (very fast)
The same with SELECT MIN(id)
 How about: SELECT MAX(id), MIN(id) FROM test;
Execution plan: return to INDEX FAST FULL SCAN| T_PK with 215 consistent gets
So, do not mix SELECT MIN and MAX together
4/2/2014A. Practices 5
1. Select MIN and MAX(cont)
Use this: SELECT MAX(id) FROM test UNION
SELECT MIN(id) FROM test;
Execution plan: 2 INDEX FULL SCAN (MIN/MAX)| T_PK with 4 consistent gets
(much faster)
4/2/2014A. Practices 6
2. COUNT(*), COUNT(1) or COUNT(PK)
 Which one is faster to get the number of row from a table?
Answer: No different.
Execution plan: INDEX FAST FULL SCAN| T_PK
 The same to count(‘any_string’).
 But how about count(non_index_column)?
Execution plan: TABLE ACCESS FULL (not a good idea)
 To make the execution plan change back to INDEX FAST FULL
SCAN:
SELECT COUNT (index_column) FROM …
Note: Although indexing make the statement run faster but still not as well as the first
solution
So, we should use COUNT(*), COUNT(1) or COUNT(PK)
4/2/2014A. Practices 7
3. NOT IN vs MINUS
Which one is faster to get rid of one part of the result?
 NOT IN:
 A full table scan is done on table1
 For each table1 row, a lookup is then done in table2.
 If no row is found in table2, the table1 row is returned
 MINUS:
 A full scan is done on both tables
 The results for table2 are removed from the results for table1
4/2/2014A. Practices 8
3. NOT IN vs MINUS(cont)
Example: TABLE1: 20,000 rows in 1000 blocks
TABLE2: 1,000 rows in 50 blocks
 Reads required for MINUS :
Full scan of TABLE1 = 1000 blocks
+Full scan of Table2 = 50 blocks
= 1050 reads
 Reads required for NOT IN:
Full scan of TABLE1 = 1000 blocks
20,000 lookups in TABLE2 = 20,000 x (depth of index on TABLE2)
= 21,000 reads at least
A lot more work is done by the NOT IN query. In
this case, MINUS is faster.
4/2/2014A. Practices 9
3. NOT IN vs MINUS(cont)
Example: TABLE1: 20,000 rows in 1000 blocks
TABLE2: 1,000,000 rows in 50,000 blocks
 Reads required for MINUS :
Full scan of TABLE1 = 1000 blocks
+Full scan of Table2 = 50,000 blocks
= 51,000 reads
 Reads required for NOT IN:
Full scan of TABLE1 = 1000 blocks
20,000 lookups in TABLE2 = 20,000 x (depth of index on TABLE2)
= 21,000 reads at least
Now, the MINUS maybe is much more heavier than
NOT IN query. In this case, NOT IN is faster.
4/2/2014A. Practices 10
3. NOT IN vs MINUS(cont)
Conclusion:
There really isn’t just one right way to design queries. In some
cases, you really are better off using NOT IN. In many cases,
however, you should use the set operator MINUS. Once you
understand the principles, you can easily choose the best method
for your particular case.
Note: Similar to NOT EXIST.
4/2/2014A. Practices 11
4. Ignored hints
 Syntax error hint:
 Semantic error hint:
 Incompatible hints:
 Parallel with Index hints.
 Full with Index hints.
4/2/2014A. Practices 12
5. Nested Loop is not good ?
 Original
4/2/2014A. Practices 13
5. Nested Loop is not good ? (cont)
 Original – execution plan
4/2/2014A. Practices 14
5. Nested Loop is not good ? (cont)
 Enhanced
4/2/2014A. Practices 15
5. Nested Loop is not good ? (cont)
 Enhanced - execution plan
4/2/2014A. Practices 16
5. Nested Loop is not good ? (cont)
 Conclusion
 Improved response time about 33 times (7.187/0.218) for the same data set.
 It’s depend on available data set.
 Enhanced version still not the best solution.
4/2/2014A. Practices 17
6. Full table scans and Parallel hints
 We should use full table scan with parallel hint. It can take advantage
of multi-CPU system.
 Example:
SELECT /*+ FULL(OP1) PARALLEL(OP1 4) */
PROC_DATE, CLASS_SYM, EXPR_DATE, EXER_PRICE,
PUT_CALL_CODE, CLEAR_FIRM_CODE, ACCT_ORIG_CODE,
SUB_ACCT_CODE, SOD_LONG_QTY, SOD_SHORT_QTY,
EOD_LONG_QTY, EOD_SHORT_QTY
FROM OPT_DDS_OPEN_POS OP1
WHERE PROC_DATE BETWEEN v_min_date AND v_process_date
4/2/2014A. Practices 18
7. NOT IN and NOT EXISTS as outer joins
 For faster execution plan and take advantage of hints.
 Example:
SELECT book_key FROM book
WHERE
book_key NOT IN (SELECT book_key FROM sales);
 We can rewrite the following statement as below:
SELECT b.book_key FROM book b, sales s
WHERE
b.book_key = s.book_key(+)
and
s.book_key IS NULL;
4/2/2014A. Practices 19
8. Correlated Subqueries Using EXISTS clause
 Oracle calls this class of subqueries correlated because a Boolean
condition in the where clause of the inner query references a
corresponding row in the outer query.
 Oracle can transform the correlated subquery to a join IF:
 The correlated subquery must use the EXISTS clause.
 The outer query cannot also be a subquery (For example, a nested
subquery).
 The correlation criteria in the inner query must use the equality
operator, “=”.
 The subquery cannot contain a group by or connect by reference.
 The equality operator in the subquery must only return a single row.
4/2/2014A. Practices 20
8. Correlated Subqueries Using EXISTS clause
 (cont) The following query returns all employees with bad credit:
SELECT ename FROM emp e
WHERE EXISTS
(SELECT null FROM bad_credit b
WHERE e.empno=b.empno
);
 We can rewrite as below:
SELECT/*+ rule */ ename
FROM emp e, bad_credit b
WHERE e.empno=b.empno;
Note: The standard join is easier to understand and also allows us to alter the execution
plan by adding hints.
4/2/2014A. Practices 21
9. Selecting many rows, unbounded result set
4/2/2014A. Practices 22
-- Cur is already open here.
LOOP
FETCH Cur INTO Record;
Process_One_Record(Record);
EXIT WHEN Cur%NOTFOUND;
...
END LOOP;
Have a look at this code
9. Selecting many rows, unbounded result set
(cont)
4/2/2014A. Practices 23
-- Cur is already open here.
-- The fetch syntax is the same for an explicit cursor and a
cursor variable.
LOOP
FETCH Cur BULK COLLECT INTO Results LIMIT Batchsize;
-- The for loop doesn't run when Results.Count() = 0
FOR j IN 1..Results.Count() LOOP
Process_One_Record(Results(j));
END LOOP;
EXIT WHEN Results.Count() < Batchsize;
END LOOP;
CLOSE Cur;
Now, we have better performance
9. Selecting many rows, unbounded result set
(cont)
 Principles
 Don’t test the %NotFound cursor attribute to terminate the loop.
 Use exit when Results.Count() < Batchsize; as the last statement in the
loop;
 When embedded SQL is sufficient, use an explicit cursor.
 When you need native dynamic SQL, use a cursor variable
4/2/2014A. Practices 24
10. Selecting many rows, bounded result set
 Let’s have a look:
DECLARE
Target_Varray_Too_Small EXCEPTION;
PRAGMA Exception_Init(Target_Varray_Too_Small, -22165);
BEGIN
SELECT a.PK, a.v1
BULK COLLECT INTO x.Results
FROM t a
WHERE a.PK > x.Some_Value
ORDER BY a.PK;
EXCEPTION WHEN Target_Varray_Too_Small THEN
Raise_Application_Error(-20000,
'Fatal: Business Rule 12345 violated.');
END;
4/2/2014A. Practices 25
10. Selecting many rows, bounded result set
(cont)
 Should be like this:
-- Set the lower and upper bound of the slice.
lb := Slice_Size*(Slice_No - 1) + 1;
ub := lb + Slice_Size - 1;
WITH Unbounded AS (
SELECT a.PK, a.v1, ROWNUM r
FROM t a
ORDER BY a.PK)
SELECT Unbounded.PK, Unbounded.v1
BULK COLLECT INTO b.Results
FROM Unbounded
WHERE Unbounded.r BETWEEN b.lb AND b.ub;
4/2/2014A. Practices 26
10. Selecting many rows, bounded result set
(cont)
 Principles
 Fetch all the rows in a single step.
 Use the cursor-less PL/SQL constructs select... bulk collect into when
embedded SQL is possible, and execute immediate... bulk collect into
when dynamic SQL is needed.
 Implement an exception handler for ORA-22165 to help bug diagnosis.
 Fetch into a varray declared with the maximum.
4/2/2014A. Practices 27
11. Selecting single row
 Look at this piece of code
4/2/2014A. Practices 28
Cur Sys_Refcursor;
Stmt CONSTANT varchar2(200) := '
SELECT a.PK, a.v1
FROM t a
WHERE a.PK = :b1';
OPEN Cur FOR Stmt USING
Some_Value;
-- Cur is already open here.
-- The fetch syntax is the same
for
-- an explicit cursor and a cursor
variable.
FETCH Cur INTO The_Result;
CLOSE Cur;
11. Selecting single row(cont)
 We should do like this
4/2/2014A. Practices 29
DECLARE
Stmt CONSTANT varchar2(200)
:= '
SELECT a.PK, a.v1
FROM t a
WHERE a.PK = :b1';
BEGIN
EXECUTE IMMEDIATE Stmt
INTO The_Result
USING Some_Value;
SELECT a.PK, a.v1
INTO b.The_Result
FROM t a
WHERE a.PK =
Some_Value;
Embbeded
SQL
Native dynamic
SQL
11. Selecting single row(cont)
 Principles
 Fetch the row in a single step.
 Use the cursor-less PL/SQL constructs select... into when embedded SQL
is possible.
 And execute immediate... into when dynamic SQL is needed.
 Take advantage of No_Data_Found exception and Too_Many_Rows
exception.
4/2/2014A. Practices 30
Resources
 Doing SQL from PL/SQL: Best and Worst Practices – Oracle.
 Tuning Oracle Stored Procedures – Guy Harrison, Quest Software.
 Turbo-charge PL/SQL Performance with Bulk Processing Features –
Steven Feuerstein, ToadWorld.com.
 The “Top 10” Dumbest PL/SQL Things I Have Seen or Done – Steven
Feuerstein, Quest Software.
 Oracle Documentation about Memory Architecture
 Understanding explain plan
 When NOT EXIST should NOT EXIST
 OCCADJ scripts.
4/2/2014B. Resources 31
Q/A
4/2/2014C. Q/A 32

More Related Content

What's hot

A green solution to solve a race condition problem
A green solution to solve a race condition problemA green solution to solve a race condition problem
A green solution to solve a race condition problem
Kai Zhou
 
What's new in java 8
What's new in java 8What's new in java 8
What's new in java 8
Dian Aditya
 
Introduction to programming in MATLAB
Introduction to programming in MATLABIntroduction to programming in MATLAB
Introduction to programming in MATLAB
mustafa_92
 
PLSQL Advanced
PLSQL AdvancedPLSQL Advanced
PLSQL Advanced
Quang Minh Đoàn
 
Functions in c mrs.sowmya jyothi
Functions in c mrs.sowmya jyothiFunctions in c mrs.sowmya jyothi
Functions in c mrs.sowmya jyothi
Sowmya Jyothi
 
Introduction to SkyPat 2.0
Introduction to SkyPat 2.0Introduction to SkyPat 2.0
Introduction to SkyPat 2.0
Little Sky
 
Matlab commands
Matlab commandsMatlab commands
Matlab commands
Tarun Gehlot
 
The Stack And Recursion
The Stack And RecursionThe Stack And Recursion
The Stack And Recursion
Ashim Lamichhane
 
Flight Landing Analysis
Flight Landing AnalysisFlight Landing Analysis
Flight Landing Analysis
Tauseef Alam
 
Module 01 Stack and Recursion
Module 01 Stack and RecursionModule 01 Stack and Recursion
Module 01 Stack and Recursion
Tushar B Kute
 
Chap07 scr
Chap07 scrChap07 scr
Chap07 scr
Hirwanto Iwan
 
01 stack 20160908_jintaek_seo
01 stack 20160908_jintaek_seo01 stack 20160908_jintaek_seo
01 stack 20160908_jintaek_seo
JinTaek Seo
 
358 33 powerpoint-slides_9-stacks-queues_chapter-9
358 33 powerpoint-slides_9-stacks-queues_chapter-9358 33 powerpoint-slides_9-stacks-queues_chapter-9
358 33 powerpoint-slides_9-stacks-queues_chapter-9
sumitbardhan
 
Electrical Engineering Exam Help
Electrical Engineering Exam HelpElectrical Engineering Exam Help
Electrical Engineering Exam Help
Live Exam Helper
 
Ch13
Ch13Ch13
Regression Analysis on Flights data
Regression Analysis on Flights dataRegression Analysis on Flights data
Regression Analysis on Flights data
Mansi Verma
 
Co&amp;al lecture-08
Co&amp;al lecture-08Co&amp;al lecture-08
Co&amp;al lecture-08
AbdulKarim563520
 
Insertion sort and shell sort
Insertion sort and shell sortInsertion sort and shell sort
Insertion sort and shell sort
Praveen Kumar
 
28890 lecture10
28890 lecture1028890 lecture10
Stack & heap
Stack & heap Stack & heap
Stack & heap
Shajahan T S Shah
 

What's hot (20)

A green solution to solve a race condition problem
A green solution to solve a race condition problemA green solution to solve a race condition problem
A green solution to solve a race condition problem
 
What's new in java 8
What's new in java 8What's new in java 8
What's new in java 8
 
Introduction to programming in MATLAB
Introduction to programming in MATLABIntroduction to programming in MATLAB
Introduction to programming in MATLAB
 
PLSQL Advanced
PLSQL AdvancedPLSQL Advanced
PLSQL Advanced
 
Functions in c mrs.sowmya jyothi
Functions in c mrs.sowmya jyothiFunctions in c mrs.sowmya jyothi
Functions in c mrs.sowmya jyothi
 
Introduction to SkyPat 2.0
Introduction to SkyPat 2.0Introduction to SkyPat 2.0
Introduction to SkyPat 2.0
 
Matlab commands
Matlab commandsMatlab commands
Matlab commands
 
The Stack And Recursion
The Stack And RecursionThe Stack And Recursion
The Stack And Recursion
 
Flight Landing Analysis
Flight Landing AnalysisFlight Landing Analysis
Flight Landing Analysis
 
Module 01 Stack and Recursion
Module 01 Stack and RecursionModule 01 Stack and Recursion
Module 01 Stack and Recursion
 
Chap07 scr
Chap07 scrChap07 scr
Chap07 scr
 
01 stack 20160908_jintaek_seo
01 stack 20160908_jintaek_seo01 stack 20160908_jintaek_seo
01 stack 20160908_jintaek_seo
 
358 33 powerpoint-slides_9-stacks-queues_chapter-9
358 33 powerpoint-slides_9-stacks-queues_chapter-9358 33 powerpoint-slides_9-stacks-queues_chapter-9
358 33 powerpoint-slides_9-stacks-queues_chapter-9
 
Electrical Engineering Exam Help
Electrical Engineering Exam HelpElectrical Engineering Exam Help
Electrical Engineering Exam Help
 
Ch13
Ch13Ch13
Ch13
 
Regression Analysis on Flights data
Regression Analysis on Flights dataRegression Analysis on Flights data
Regression Analysis on Flights data
 
Co&amp;al lecture-08
Co&amp;al lecture-08Co&amp;al lecture-08
Co&amp;al lecture-08
 
Insertion sort and shell sort
Insertion sort and shell sortInsertion sort and shell sort
Insertion sort and shell sort
 
28890 lecture10
28890 lecture1028890 lecture10
28890 lecture10
 
Stack & heap
Stack & heap Stack & heap
Stack & heap
 

Viewers also liked

Oracle 11g sql plsql training
Oracle 11g sql plsql trainingOracle 11g sql plsql training
Oracle 11g sql plsql training
FuturePoint Technologies
 
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
Alex Zaballa
 
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c  - New Features for Developers and DBAsOracle Database 12c  - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAs
Alex Zaballa
 
Oracle PLSQL Step By Step Guide
Oracle PLSQL Step By Step GuideOracle PLSQL Step By Step Guide
Oracle PLSQL Step By Step Guide
Srinimf-Slides
 
PL/SQL Introduction and Concepts
PL/SQL Introduction and Concepts PL/SQL Introduction and Concepts
PL/SQL Introduction and Concepts
Bharat Kalia
 
ORACLE PL SQL FOR BEGINNERS
ORACLE PL SQL FOR BEGINNERSORACLE PL SQL FOR BEGINNERS
ORACLE PL SQL FOR BEGINNERS
mohdoracle
 
High Performance Plsql
High Performance PlsqlHigh Performance Plsql
High Performance Plsql
Guy Harrison
 
Sql queries interview questions
Sql queries interview questionsSql queries interview questions
Sql queries interview questions
Pyadav010186
 
Oracle: PLSQL
Oracle: PLSQLOracle: PLSQL
Oracle: PLSQL
DataminingTools Inc
 

Viewers also liked (9)

Oracle 11g sql plsql training
Oracle 11g sql plsql trainingOracle 11g sql plsql training
Oracle 11g sql plsql training
 
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
 
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c  - New Features for Developers and DBAsOracle Database 12c  - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAs
 
Oracle PLSQL Step By Step Guide
Oracle PLSQL Step By Step GuideOracle PLSQL Step By Step Guide
Oracle PLSQL Step By Step Guide
 
PL/SQL Introduction and Concepts
PL/SQL Introduction and Concepts PL/SQL Introduction and Concepts
PL/SQL Introduction and Concepts
 
ORACLE PL SQL FOR BEGINNERS
ORACLE PL SQL FOR BEGINNERSORACLE PL SQL FOR BEGINNERS
ORACLE PL SQL FOR BEGINNERS
 
High Performance Plsql
High Performance PlsqlHigh Performance Plsql
High Performance Plsql
 
Sql queries interview questions
Sql queries interview questionsSql queries interview questions
Sql queries interview questions
 
Oracle: PLSQL
Oracle: PLSQLOracle: PLSQL
Oracle: PLSQL
 

Similar to PLSQL Practices

Procedures andcursors
Procedures andcursorsProcedures andcursors
Procedures andcursors
LakshmiSamivel
 
Top 10 Oracle SQL tuning tips
Top 10 Oracle SQL tuning tipsTop 10 Oracle SQL tuning tips
Top 10 Oracle SQL tuning tips
Nirav Shah
 
Query Optimization & How to interpret query execution plan
Query Optimization & How to interpret query  execution planQuery Optimization & How to interpret query  execution plan
Query Optimization & How to interpret query execution plan
Amol Barewar
 
04 laboratory exercise 1
04 laboratory exercise 104 laboratory exercise 1
04 laboratory exercise 1
Anne Lee
 
pm1
pm1pm1
Myth busters - performance tuning 101 2007
Myth busters - performance tuning 101 2007Myth busters - performance tuning 101 2007
Myth busters - performance tuning 101 2007
paulguerin
 
Oracle tips and tricks
Oracle tips and tricksOracle tips and tricks
Oracle tips and tricks
Yanli Liu
 
Advanced MySQL Query Optimizations
Advanced MySQL Query OptimizationsAdvanced MySQL Query Optimizations
Advanced MySQL Query Optimizations
Dave Stokes
 
Introduction to flowchart
Introduction to flowchartIntroduction to flowchart
Introduction to flowchart
Jordan Delacruz
 
Sql db optimization
Sql db optimizationSql db optimization
Sql db optimization
Nikhildas P C
 
Sql scripting sorcerypaper
Sql scripting sorcerypaperSql scripting sorcerypaper
Sql scripting sorcerypaper
oracle documents
 
Lab3 testbench tutorial (1)
Lab3 testbench tutorial (1)Lab3 testbench tutorial (1)
Lab3 testbench tutorial (1)
Abhishek Bose
 
Interview Preparation
Interview PreparationInterview Preparation
Interview Preparation
Ravi Kanudawala
 
Performance tuning
Performance tuningPerformance tuning
Performance tuning
ami111
 
Excel Tips
Excel TipsExcel Tips
Excel Tips
guesta74c1f59
 
PLSQL Tutorial
PLSQL TutorialPLSQL Tutorial
PLSQL Tutorial
Quang Minh Đoàn
 
29 19 sep17 17may 6637 10140-1-ed(edit)
29 19 sep17 17may 6637 10140-1-ed(edit)29 19 sep17 17may 6637 10140-1-ed(edit)
29 19 sep17 17may 6637 10140-1-ed(edit)
IAESIJEECS
 
29 19 sep17 17may 6637 10140-1-ed(edit)
29 19 sep17 17may 6637 10140-1-ed(edit)29 19 sep17 17may 6637 10140-1-ed(edit)
29 19 sep17 17may 6637 10140-1-ed(edit)
IAESIJEECS
 
Top 10 sap abap faqs-www.bigclasses.com
Top 10 sap abap faqs-www.bigclasses.comTop 10 sap abap faqs-www.bigclasses.com
Top 10 sap abap faqs-www.bigclasses.com
bigclasses.com
 
Excel Useful Tips
Excel Useful TipsExcel Useful Tips
Excel Useful Tips
Parul_100in
 

Similar to PLSQL Practices (20)

Procedures andcursors
Procedures andcursorsProcedures andcursors
Procedures andcursors
 
Top 10 Oracle SQL tuning tips
Top 10 Oracle SQL tuning tipsTop 10 Oracle SQL tuning tips
Top 10 Oracle SQL tuning tips
 
Query Optimization & How to interpret query execution plan
Query Optimization & How to interpret query  execution planQuery Optimization & How to interpret query  execution plan
Query Optimization & How to interpret query execution plan
 
04 laboratory exercise 1
04 laboratory exercise 104 laboratory exercise 1
04 laboratory exercise 1
 
pm1
pm1pm1
pm1
 
Myth busters - performance tuning 101 2007
Myth busters - performance tuning 101 2007Myth busters - performance tuning 101 2007
Myth busters - performance tuning 101 2007
 
Oracle tips and tricks
Oracle tips and tricksOracle tips and tricks
Oracle tips and tricks
 
Advanced MySQL Query Optimizations
Advanced MySQL Query OptimizationsAdvanced MySQL Query Optimizations
Advanced MySQL Query Optimizations
 
Introduction to flowchart
Introduction to flowchartIntroduction to flowchart
Introduction to flowchart
 
Sql db optimization
Sql db optimizationSql db optimization
Sql db optimization
 
Sql scripting sorcerypaper
Sql scripting sorcerypaperSql scripting sorcerypaper
Sql scripting sorcerypaper
 
Lab3 testbench tutorial (1)
Lab3 testbench tutorial (1)Lab3 testbench tutorial (1)
Lab3 testbench tutorial (1)
 
Interview Preparation
Interview PreparationInterview Preparation
Interview Preparation
 
Performance tuning
Performance tuningPerformance tuning
Performance tuning
 
Excel Tips
Excel TipsExcel Tips
Excel Tips
 
PLSQL Tutorial
PLSQL TutorialPLSQL Tutorial
PLSQL Tutorial
 
29 19 sep17 17may 6637 10140-1-ed(edit)
29 19 sep17 17may 6637 10140-1-ed(edit)29 19 sep17 17may 6637 10140-1-ed(edit)
29 19 sep17 17may 6637 10140-1-ed(edit)
 
29 19 sep17 17may 6637 10140-1-ed(edit)
29 19 sep17 17may 6637 10140-1-ed(edit)29 19 sep17 17may 6637 10140-1-ed(edit)
29 19 sep17 17may 6637 10140-1-ed(edit)
 
Top 10 sap abap faqs-www.bigclasses.com
Top 10 sap abap faqs-www.bigclasses.comTop 10 sap abap faqs-www.bigclasses.com
Top 10 sap abap faqs-www.bigclasses.com
 
Excel Useful Tips
Excel Useful TipsExcel Useful Tips
Excel Useful Tips
 

Recently uploaded

The Ipsos - AI - Monitor 2024 Report.pdf
The  Ipsos - AI - Monitor 2024 Report.pdfThe  Ipsos - AI - Monitor 2024 Report.pdf
The Ipsos - AI - Monitor 2024 Report.pdf
Social Samosa
 
ViewShift: Hassle-free Dynamic Policy Enforcement for Every Data Lake
ViewShift: Hassle-free Dynamic Policy Enforcement for Every Data LakeViewShift: Hassle-free Dynamic Policy Enforcement for Every Data Lake
ViewShift: Hassle-free Dynamic Policy Enforcement for Every Data Lake
Walaa Eldin Moustafa
 
一比一原版(Chester毕业证书)切斯特大学毕业证如何办理
一比一原版(Chester毕业证书)切斯特大学毕业证如何办理一比一原版(Chester毕业证书)切斯特大学毕业证如何办理
一比一原版(Chester毕业证书)切斯特大学毕业证如何办理
74nqk8xf
 
Predictably Improve Your B2B Tech Company's Performance by Leveraging Data
Predictably Improve Your B2B Tech Company's Performance by Leveraging DataPredictably Improve Your B2B Tech Company's Performance by Leveraging Data
Predictably Improve Your B2B Tech Company's Performance by Leveraging Data
Kiwi Creative
 
Global Situational Awareness of A.I. and where its headed
Global Situational Awareness of A.I. and where its headedGlobal Situational Awareness of A.I. and where its headed
Global Situational Awareness of A.I. and where its headed
vikram sood
 
A presentation that explain the Power BI Licensing
A presentation that explain the Power BI LicensingA presentation that explain the Power BI Licensing
A presentation that explain the Power BI Licensing
AlessioFois2
 
End-to-end pipeline agility - Berlin Buzzwords 2024
End-to-end pipeline agility - Berlin Buzzwords 2024End-to-end pipeline agility - Berlin Buzzwords 2024
End-to-end pipeline agility - Berlin Buzzwords 2024
Lars Albertsson
 
Analysis insight about a Flyball dog competition team's performance
Analysis insight about a Flyball dog competition team's performanceAnalysis insight about a Flyball dog competition team's performance
Analysis insight about a Flyball dog competition team's performance
roli9797
 
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
nuttdpt
 
一比一原版(Harvard毕业证书)哈佛大学毕业证如何办理
一比一原版(Harvard毕业证书)哈佛大学毕业证如何办理一比一原版(Harvard毕业证书)哈佛大学毕业证如何办理
一比一原版(Harvard毕业证书)哈佛大学毕业证如何办理
zsjl4mimo
 
Influence of Marketing Strategy and Market Competition on Business Plan
Influence of Marketing Strategy and Market Competition on Business PlanInfluence of Marketing Strategy and Market Competition on Business Plan
Influence of Marketing Strategy and Market Competition on Business Plan
jerlynmaetalle
 
Udemy_2024_Global_Learning_Skills_Trends_Report (1).pdf
Udemy_2024_Global_Learning_Skills_Trends_Report (1).pdfUdemy_2024_Global_Learning_Skills_Trends_Report (1).pdf
Udemy_2024_Global_Learning_Skills_Trends_Report (1).pdf
Fernanda Palhano
 
一比一原版(牛布毕业证书)牛津布鲁克斯大学毕业证如何办理
一比一原版(牛布毕业证书)牛津布鲁克斯大学毕业证如何办理一比一原版(牛布毕业证书)牛津布鲁克斯大学毕业证如何办理
一比一原版(牛布毕业证书)牛津布鲁克斯大学毕业证如何办理
74nqk8xf
 
一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理
aqzctr7x
 
Challenges of Nation Building-1.pptx with more important
Challenges of Nation Building-1.pptx with more importantChallenges of Nation Building-1.pptx with more important
Challenges of Nation Building-1.pptx with more important
Sm321
 
一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理
一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理
一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理
nyfuhyz
 
一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
nuttdpt
 
DSSML24_tspann_CodelessGenerativeAIPipelines
DSSML24_tspann_CodelessGenerativeAIPipelinesDSSML24_tspann_CodelessGenerativeAIPipelines
DSSML24_tspann_CodelessGenerativeAIPipelines
Timothy Spann
 
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
Social Samosa
 
Population Growth in Bataan: The effects of population growth around rural pl...
Population Growth in Bataan: The effects of population growth around rural pl...Population Growth in Bataan: The effects of population growth around rural pl...
Population Growth in Bataan: The effects of population growth around rural pl...
Bill641377
 

Recently uploaded (20)

The Ipsos - AI - Monitor 2024 Report.pdf
The  Ipsos - AI - Monitor 2024 Report.pdfThe  Ipsos - AI - Monitor 2024 Report.pdf
The Ipsos - AI - Monitor 2024 Report.pdf
 
ViewShift: Hassle-free Dynamic Policy Enforcement for Every Data Lake
ViewShift: Hassle-free Dynamic Policy Enforcement for Every Data LakeViewShift: Hassle-free Dynamic Policy Enforcement for Every Data Lake
ViewShift: Hassle-free Dynamic Policy Enforcement for Every Data Lake
 
一比一原版(Chester毕业证书)切斯特大学毕业证如何办理
一比一原版(Chester毕业证书)切斯特大学毕业证如何办理一比一原版(Chester毕业证书)切斯特大学毕业证如何办理
一比一原版(Chester毕业证书)切斯特大学毕业证如何办理
 
Predictably Improve Your B2B Tech Company's Performance by Leveraging Data
Predictably Improve Your B2B Tech Company's Performance by Leveraging DataPredictably Improve Your B2B Tech Company's Performance by Leveraging Data
Predictably Improve Your B2B Tech Company's Performance by Leveraging Data
 
Global Situational Awareness of A.I. and where its headed
Global Situational Awareness of A.I. and where its headedGlobal Situational Awareness of A.I. and where its headed
Global Situational Awareness of A.I. and where its headed
 
A presentation that explain the Power BI Licensing
A presentation that explain the Power BI LicensingA presentation that explain the Power BI Licensing
A presentation that explain the Power BI Licensing
 
End-to-end pipeline agility - Berlin Buzzwords 2024
End-to-end pipeline agility - Berlin Buzzwords 2024End-to-end pipeline agility - Berlin Buzzwords 2024
End-to-end pipeline agility - Berlin Buzzwords 2024
 
Analysis insight about a Flyball dog competition team's performance
Analysis insight about a Flyball dog competition team's performanceAnalysis insight about a Flyball dog competition team's performance
Analysis insight about a Flyball dog competition team's performance
 
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
 
一比一原版(Harvard毕业证书)哈佛大学毕业证如何办理
一比一原版(Harvard毕业证书)哈佛大学毕业证如何办理一比一原版(Harvard毕业证书)哈佛大学毕业证如何办理
一比一原版(Harvard毕业证书)哈佛大学毕业证如何办理
 
Influence of Marketing Strategy and Market Competition on Business Plan
Influence of Marketing Strategy and Market Competition on Business PlanInfluence of Marketing Strategy and Market Competition on Business Plan
Influence of Marketing Strategy and Market Competition on Business Plan
 
Udemy_2024_Global_Learning_Skills_Trends_Report (1).pdf
Udemy_2024_Global_Learning_Skills_Trends_Report (1).pdfUdemy_2024_Global_Learning_Skills_Trends_Report (1).pdf
Udemy_2024_Global_Learning_Skills_Trends_Report (1).pdf
 
一比一原版(牛布毕业证书)牛津布鲁克斯大学毕业证如何办理
一比一原版(牛布毕业证书)牛津布鲁克斯大学毕业证如何办理一比一原版(牛布毕业证书)牛津布鲁克斯大学毕业证如何办理
一比一原版(牛布毕业证书)牛津布鲁克斯大学毕业证如何办理
 
一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理
 
Challenges of Nation Building-1.pptx with more important
Challenges of Nation Building-1.pptx with more importantChallenges of Nation Building-1.pptx with more important
Challenges of Nation Building-1.pptx with more important
 
一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理
一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理
一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理
 
一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
 
DSSML24_tspann_CodelessGenerativeAIPipelines
DSSML24_tspann_CodelessGenerativeAIPipelinesDSSML24_tspann_CodelessGenerativeAIPipelines
DSSML24_tspann_CodelessGenerativeAIPipelines
 
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
 
Population Growth in Bataan: The effects of population growth around rural pl...
Population Growth in Bataan: The effects of population growth around rural pl...Population Growth in Bataan: The effects of population growth around rural pl...
Population Growth in Bataan: The effects of population growth around rural pl...
 

PLSQL Practices

  • 1. Author: Duy Tran Minh Doan 10, April 2012 4/2/2014 1
  • 2. Objective This slide provides practices which worth considered in coding PL/SQL. You should have your senior reviewed or evaluated them before using in production code. 4/2/2014 2
  • 3. Agenda A. Practices 1. Select MIN and MAX 2. COUNT(*), COUNT(1) or COUNT(PK) ? 3. NOT IN vs MINUS 4. Ignored hints 5. Nested Loop is not good ? 6. Full table scans and Parallel hints 7. NOT IN and NOT EXISTS as outer joins 8. Correlated Subqueries Using EXISTS clause 9. Selecting many rows, unbounded result set 10. Selecting many rows, bounded result set 11. Selecting single row B. Resources C. Q/A 4/2/2014 3
  • 4. A. Practices 1. Select MIN and MAX 2. COUNT(*), COUNT(1) or COUNT(PK) ? 3. NOT IN vs MINUS 4. Ignored hints 5. Nested Loop is not good ? 6. Full table scans and Parallel hints 7. NOT IN and NOT EXISTS as outer joins 8. Correlated Subqueries Using EXISTS clause 9. Selecting many rows, unbounded result set 10. Selecting many rows, bounded result set 11. Selecting single row 4/2/2014 A. Practices 4
  • 5. 1. Select MIN and MAX We have table TEST with 100000 rows.  SELECT COUNT(id) FROM test; Execution plan: INDEX FAST FULL SCAN| T_PK with 215 consistent gets  SELECT MAX(id) FROM test; Execution plan: INDEX FULL SCAN (MIN/MAX)| T_PK with 2 consistent gets (very fast) The same with SELECT MIN(id)  How about: SELECT MAX(id), MIN(id) FROM test; Execution plan: return to INDEX FAST FULL SCAN| T_PK with 215 consistent gets So, do not mix SELECT MIN and MAX together 4/2/2014A. Practices 5
  • 6. 1. Select MIN and MAX(cont) Use this: SELECT MAX(id) FROM test UNION SELECT MIN(id) FROM test; Execution plan: 2 INDEX FULL SCAN (MIN/MAX)| T_PK with 4 consistent gets (much faster) 4/2/2014A. Practices 6
  • 7. 2. COUNT(*), COUNT(1) or COUNT(PK)  Which one is faster to get the number of row from a table? Answer: No different. Execution plan: INDEX FAST FULL SCAN| T_PK  The same to count(‘any_string’).  But how about count(non_index_column)? Execution plan: TABLE ACCESS FULL (not a good idea)  To make the execution plan change back to INDEX FAST FULL SCAN: SELECT COUNT (index_column) FROM … Note: Although indexing make the statement run faster but still not as well as the first solution So, we should use COUNT(*), COUNT(1) or COUNT(PK) 4/2/2014A. Practices 7
  • 8. 3. NOT IN vs MINUS Which one is faster to get rid of one part of the result?  NOT IN:  A full table scan is done on table1  For each table1 row, a lookup is then done in table2.  If no row is found in table2, the table1 row is returned  MINUS:  A full scan is done on both tables  The results for table2 are removed from the results for table1 4/2/2014A. Practices 8
  • 9. 3. NOT IN vs MINUS(cont) Example: TABLE1: 20,000 rows in 1000 blocks TABLE2: 1,000 rows in 50 blocks  Reads required for MINUS : Full scan of TABLE1 = 1000 blocks +Full scan of Table2 = 50 blocks = 1050 reads  Reads required for NOT IN: Full scan of TABLE1 = 1000 blocks 20,000 lookups in TABLE2 = 20,000 x (depth of index on TABLE2) = 21,000 reads at least A lot more work is done by the NOT IN query. In this case, MINUS is faster. 4/2/2014A. Practices 9
  • 10. 3. NOT IN vs MINUS(cont) Example: TABLE1: 20,000 rows in 1000 blocks TABLE2: 1,000,000 rows in 50,000 blocks  Reads required for MINUS : Full scan of TABLE1 = 1000 blocks +Full scan of Table2 = 50,000 blocks = 51,000 reads  Reads required for NOT IN: Full scan of TABLE1 = 1000 blocks 20,000 lookups in TABLE2 = 20,000 x (depth of index on TABLE2) = 21,000 reads at least Now, the MINUS maybe is much more heavier than NOT IN query. In this case, NOT IN is faster. 4/2/2014A. Practices 10
  • 11. 3. NOT IN vs MINUS(cont) Conclusion: There really isn’t just one right way to design queries. In some cases, you really are better off using NOT IN. In many cases, however, you should use the set operator MINUS. Once you understand the principles, you can easily choose the best method for your particular case. Note: Similar to NOT EXIST. 4/2/2014A. Practices 11
  • 12. 4. Ignored hints  Syntax error hint:  Semantic error hint:  Incompatible hints:  Parallel with Index hints.  Full with Index hints. 4/2/2014A. Practices 12
  • 13. 5. Nested Loop is not good ?  Original 4/2/2014A. Practices 13
  • 14. 5. Nested Loop is not good ? (cont)  Original – execution plan 4/2/2014A. Practices 14
  • 15. 5. Nested Loop is not good ? (cont)  Enhanced 4/2/2014A. Practices 15
  • 16. 5. Nested Loop is not good ? (cont)  Enhanced - execution plan 4/2/2014A. Practices 16
  • 17. 5. Nested Loop is not good ? (cont)  Conclusion  Improved response time about 33 times (7.187/0.218) for the same data set.  It’s depend on available data set.  Enhanced version still not the best solution. 4/2/2014A. Practices 17
  • 18. 6. Full table scans and Parallel hints  We should use full table scan with parallel hint. It can take advantage of multi-CPU system.  Example: SELECT /*+ FULL(OP1) PARALLEL(OP1 4) */ PROC_DATE, CLASS_SYM, EXPR_DATE, EXER_PRICE, PUT_CALL_CODE, CLEAR_FIRM_CODE, ACCT_ORIG_CODE, SUB_ACCT_CODE, SOD_LONG_QTY, SOD_SHORT_QTY, EOD_LONG_QTY, EOD_SHORT_QTY FROM OPT_DDS_OPEN_POS OP1 WHERE PROC_DATE BETWEEN v_min_date AND v_process_date 4/2/2014A. Practices 18
  • 19. 7. NOT IN and NOT EXISTS as outer joins  For faster execution plan and take advantage of hints.  Example: SELECT book_key FROM book WHERE book_key NOT IN (SELECT book_key FROM sales);  We can rewrite the following statement as below: SELECT b.book_key FROM book b, sales s WHERE b.book_key = s.book_key(+) and s.book_key IS NULL; 4/2/2014A. Practices 19
  • 20. 8. Correlated Subqueries Using EXISTS clause  Oracle calls this class of subqueries correlated because a Boolean condition in the where clause of the inner query references a corresponding row in the outer query.  Oracle can transform the correlated subquery to a join IF:  The correlated subquery must use the EXISTS clause.  The outer query cannot also be a subquery (For example, a nested subquery).  The correlation criteria in the inner query must use the equality operator, “=”.  The subquery cannot contain a group by or connect by reference.  The equality operator in the subquery must only return a single row. 4/2/2014A. Practices 20
  • 21. 8. Correlated Subqueries Using EXISTS clause  (cont) The following query returns all employees with bad credit: SELECT ename FROM emp e WHERE EXISTS (SELECT null FROM bad_credit b WHERE e.empno=b.empno );  We can rewrite as below: SELECT/*+ rule */ ename FROM emp e, bad_credit b WHERE e.empno=b.empno; Note: The standard join is easier to understand and also allows us to alter the execution plan by adding hints. 4/2/2014A. Practices 21
  • 22. 9. Selecting many rows, unbounded result set 4/2/2014A. Practices 22 -- Cur is already open here. LOOP FETCH Cur INTO Record; Process_One_Record(Record); EXIT WHEN Cur%NOTFOUND; ... END LOOP; Have a look at this code
  • 23. 9. Selecting many rows, unbounded result set (cont) 4/2/2014A. Practices 23 -- Cur is already open here. -- The fetch syntax is the same for an explicit cursor and a cursor variable. LOOP FETCH Cur BULK COLLECT INTO Results LIMIT Batchsize; -- The for loop doesn't run when Results.Count() = 0 FOR j IN 1..Results.Count() LOOP Process_One_Record(Results(j)); END LOOP; EXIT WHEN Results.Count() < Batchsize; END LOOP; CLOSE Cur; Now, we have better performance
  • 24. 9. Selecting many rows, unbounded result set (cont)  Principles  Don’t test the %NotFound cursor attribute to terminate the loop.  Use exit when Results.Count() < Batchsize; as the last statement in the loop;  When embedded SQL is sufficient, use an explicit cursor.  When you need native dynamic SQL, use a cursor variable 4/2/2014A. Practices 24
  • 25. 10. Selecting many rows, bounded result set  Let’s have a look: DECLARE Target_Varray_Too_Small EXCEPTION; PRAGMA Exception_Init(Target_Varray_Too_Small, -22165); BEGIN SELECT a.PK, a.v1 BULK COLLECT INTO x.Results FROM t a WHERE a.PK > x.Some_Value ORDER BY a.PK; EXCEPTION WHEN Target_Varray_Too_Small THEN Raise_Application_Error(-20000, 'Fatal: Business Rule 12345 violated.'); END; 4/2/2014A. Practices 25
  • 26. 10. Selecting many rows, bounded result set (cont)  Should be like this: -- Set the lower and upper bound of the slice. lb := Slice_Size*(Slice_No - 1) + 1; ub := lb + Slice_Size - 1; WITH Unbounded AS ( SELECT a.PK, a.v1, ROWNUM r FROM t a ORDER BY a.PK) SELECT Unbounded.PK, Unbounded.v1 BULK COLLECT INTO b.Results FROM Unbounded WHERE Unbounded.r BETWEEN b.lb AND b.ub; 4/2/2014A. Practices 26
  • 27. 10. Selecting many rows, bounded result set (cont)  Principles  Fetch all the rows in a single step.  Use the cursor-less PL/SQL constructs select... bulk collect into when embedded SQL is possible, and execute immediate... bulk collect into when dynamic SQL is needed.  Implement an exception handler for ORA-22165 to help bug diagnosis.  Fetch into a varray declared with the maximum. 4/2/2014A. Practices 27
  • 28. 11. Selecting single row  Look at this piece of code 4/2/2014A. Practices 28 Cur Sys_Refcursor; Stmt CONSTANT varchar2(200) := ' SELECT a.PK, a.v1 FROM t a WHERE a.PK = :b1'; OPEN Cur FOR Stmt USING Some_Value; -- Cur is already open here. -- The fetch syntax is the same for -- an explicit cursor and a cursor variable. FETCH Cur INTO The_Result; CLOSE Cur;
  • 29. 11. Selecting single row(cont)  We should do like this 4/2/2014A. Practices 29 DECLARE Stmt CONSTANT varchar2(200) := ' SELECT a.PK, a.v1 FROM t a WHERE a.PK = :b1'; BEGIN EXECUTE IMMEDIATE Stmt INTO The_Result USING Some_Value; SELECT a.PK, a.v1 INTO b.The_Result FROM t a WHERE a.PK = Some_Value; Embbeded SQL Native dynamic SQL
  • 30. 11. Selecting single row(cont)  Principles  Fetch the row in a single step.  Use the cursor-less PL/SQL constructs select... into when embedded SQL is possible.  And execute immediate... into when dynamic SQL is needed.  Take advantage of No_Data_Found exception and Too_Many_Rows exception. 4/2/2014A. Practices 30
  • 31. Resources  Doing SQL from PL/SQL: Best and Worst Practices – Oracle.  Tuning Oracle Stored Procedures – Guy Harrison, Quest Software.  Turbo-charge PL/SQL Performance with Bulk Processing Features – Steven Feuerstein, ToadWorld.com.  The “Top 10” Dumbest PL/SQL Things I Have Seen or Done – Steven Feuerstein, Quest Software.  Oracle Documentation about Memory Architecture  Understanding explain plan  When NOT EXIST should NOT EXIST  OCCADJ scripts. 4/2/2014B. Resources 31