Top Banner
http://www.oracle- base.com Boost Performance with PL/SQL Boost Performance with PL/SQL Programming Best Practices Programming Best Practices Tim Hall Tim Hall Oracle ACE Director Oracle ACE Director Oracle ACE of the Year 2006 Oracle ACE of the Year 2006 OCP DBA (7, 8, 8i, 9i, 10g, 11g) OCP DBA (7, 8, 8i, 9i, 10g, 11g) OCA PL/SQL Developer OCA PL/SQL Developer http://www.oracle-base.com http://www.oracle-base.com Oracle PL/SQL Tuning (Rampant) Oracle PL/SQL Tuning (Rampant) Oracle Job Scheduling (Rampant) Oracle Job Scheduling (Rampant)
19

Http:// Boost Performance with PL/SQL Programming Best Practices Tim Hall Oracle ACE Director Oracle ACE of the Year 2006 OCP DBA (7,

Dec 22, 2015

Download

Documents

Deborah Harper
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Http:// Boost Performance with PL/SQL Programming Best Practices Tim Hall Oracle ACE Director Oracle ACE of the Year 2006 OCP DBA (7,

http://www.oracle-base.com

Boost Performance with PL/SQL Boost Performance with PL/SQL Programming Best PracticesProgramming Best Practices

Tim HallTim Hall

Oracle ACE DirectorOracle ACE Director

Oracle ACE of the Year 2006Oracle ACE of the Year 2006OCP DBA (7, 8, 8i, 9i, 10g, 11g)OCP DBA (7, 8, 8i, 9i, 10g, 11g)

OCA PL/SQL DeveloperOCA PL/SQL Developer

http://www.oracle-base.comhttp://www.oracle-base.com

Oracle PL/SQL Tuning (Rampant)Oracle PL/SQL Tuning (Rampant)Oracle Job Scheduling (Rampant)Oracle Job Scheduling (Rampant)

Page 2: Http:// Boost Performance with PL/SQL Programming Best Practices Tim Hall Oracle ACE Director Oracle ACE of the Year 2006 OCP DBA (7,

http://www.oracle-base.com

Page 3: Http:// Boost Performance with PL/SQL Programming Best Practices Tim Hall Oracle ACE Director Oracle ACE of the Year 2006 OCP DBA (7,

http://www.oracle-base.com

Bind VariablesBind Variables

• Oracle performs a CPU intensive hard parse for all new Oracle performs a CPU intensive hard parse for all new statements. Unnecessary parses waste CPU and memory.statements. Unnecessary parses waste CPU and memory.

• Statements already present in the shared pool only require a Statements already present in the shared pool only require a soft parse.soft parse.

• Statement matching uses “Exact Text Match”, so literals, case Statement matching uses “Exact Text Match”, so literals, case and whitespaces are a problem.and whitespaces are a problem.

• Make sure client application use bind variables when calling Make sure client application use bind variables when calling your code.your code.

• Use CURSOR_SHARING parameter when you can’t alter code.Use CURSOR_SHARING parameter when you can’t alter code.

• Be careful when using dynamic SQL. Be careful when using dynamic SQL.

SELECT * FROM emp WHERE empno = 1;SELECT * FROM emp WHERE empno = 1;SELECT * FROM emp WHERE empno = 2;SELECT * FROM emp WHERE empno = 2;SELECT * FROM emp WHERE empno = :p_empno;SELECT * FROM emp WHERE empno = :p_empno;

ALTER SESSION SET cursor_sharing = force;ALTER SESSION SET cursor_sharing = force;

Page 4: Http:// Boost Performance with PL/SQL Programming Best Practices Tim Hall Oracle ACE Director Oracle ACE of the Year 2006 OCP DBA (7,

http://www.oracle-base.com

Overview of the PL/SQL EngineOverview of the PL/SQL Engine

• PL/SQL contains procedural and SQL code.PL/SQL contains procedural and SQL code.• Each type of code is processed separately.Each type of code is processed separately.• Switching between code types causes an overhead.Switching between code types causes an overhead.• The overhead is very noticeable during batch operations.The overhead is very noticeable during batch operations.• Bulk binds minimize this overhead.Bulk binds minimize this overhead.

Oracle ServerOracle Server

PL/SQL EnginePL/SQL Engine

PL/SQLPL/SQLBlockBlock

PL/SQLPL/SQLBlockBlock

ProceduralProceduralStatementStatementExecutorExecutor

SQL StatementSQL StatementExecutorExecutor

Page 5: Http:// Boost Performance with PL/SQL Programming Best Practices Tim Hall Oracle ACE Director Oracle ACE of the Year 2006 OCP DBA (7,

http://www.oracle-base.com

Bulk-Binds – BULK COLLECTBulk-Binds – BULK COLLECT

• Populate collections directly Populate collections directly from SQL using BULK from SQL using BULK COLLECT.COLLECT.

• DemoDemo• Collections are held in Collections are held in

memory, so watch collection memory, so watch collection sizes.sizes.

• DemoDemo• Implicit array processing Implicit array processing

introduced in 10g.introduced in 10g.• DemoDemo

SELECT *SELECT *BULK COLLECT INTO l_tabBULK COLLECT INTO l_tabFROM tab1;FROM tab1;

OPEN c1;OPEN c1;LOOPLOOP FETCH c1FETCH c1 BULK COLLECTBULK COLLECT INTO l_tab LIMIT 1000;INTO l_tab LIMIT 1000; EXIT WHEN l_tab.count = 0;EXIT WHEN l_tab.count = 0;

-- Process chunk.-- Process chunk.END LOOP;END LOOP;CLOSE c1;CLOSE c1;

FOR cur_rec IN (SELECT * FROM tab1)FOR cur_rec IN (SELECT * FROM tab1)LOOPLOOP -- Process row.-- Process row.END LOOP;END LOOP;

Page 6: Http:// Boost Performance with PL/SQL Programming Best Practices Tim Hall Oracle ACE Director Oracle ACE of the Year 2006 OCP DBA (7,

http://www.oracle-base.com

Bulk-Binds – FORALLBulk-Binds – FORALL

• Bind data in collections into DML Bind data in collections into DML using FORALL.using FORALL.

• DemoDemo• Use Use INDICIES OF and VALUES OF INDICIES OF and VALUES OF

for sparse collections.for sparse collections.• Use Use SQL%BULK_ROWCOUNT to SQL%BULK_ROWCOUNT to

return the number of rows affected return the number of rows affected by each statement.by each statement.

• The SAVE EXCEPTIONS allows bulk The SAVE EXCEPTIONS allows bulk operations to complete.operations to complete.

• Exceptions captured in SQLExceptions captured in SQL%BULK_EXCEPTIONS.%BULK_EXCEPTIONS.

FORALL i IN l_tab.FIRST .. l_tab.LASTFORALL i IN l_tab.FIRST .. l_tab.LAST INSERT INTO tab2 VALUES l_tab(i);INSERT INTO tab2 VALUES l_tab(i);

Page 7: Http:// Boost Performance with PL/SQL Programming Best Practices Tim Hall Oracle ACE Director Oracle ACE of the Year 2006 OCP DBA (7,

http://www.oracle-base.com

Short-Circuit Evaluations and Logic OrderShort-Circuit Evaluations and Logic Order

• If left side of an OR expression is If left side of an OR expression is TRUE, the whole expression is TRUE.TRUE, the whole expression is TRUE.TRUE OR FALSE = TRUETRUE OR FALSE = TRUETRUE OR TRUE = TRUETRUE OR TRUE = TRUE

• If the left side of an AND expression is If the left side of an AND expression is FALSE, the whole expression is FALSE, the whole expression is FALSE.FALSE.FALSE AND FALSE = FALSEFALSE AND FALSE = FALSEFALSE AND TRUE = FALSEFALSE AND TRUE = FALSE

• In these cases Oracle doesn’t evaluate In these cases Oracle doesn’t evaluate the second half of the expresson.the second half of the expresson.

• Place “least expensive” tests to the Place “least expensive” tests to the left of expressions.left of expressions.

• Evaluations of ELSIF and CASE Evaluations of ELSIF and CASE statements stops once a match is statements stops once a match is found.found.

• Place the “most likely outcomes” at Place the “most likely outcomes” at the top of branching constructs.the top of branching constructs.

IF l_rec_type = 'POPULAR' THENIF l_rec_type = 'POPULAR' THEN -- Do Something-- Do SomethingELSIF l_rec_type = 'MEDIUM' THENELSIF l_rec_type = 'MEDIUM' THEN -- Do Something-- Do SomethingELSIF l_rec_type = ‘UNPOPULAR' THENELSIF l_rec_type = ‘UNPOPULAR' THEN -- Do Something-- Do SomethingEND IF;END IF;

CASE l_rec_typeCASE l_rec_type WHEN 'POPULAR' THENWHEN 'POPULAR' THEN -- Do Something-- Do Something WHEN 'MEDIUM' THENWHEN 'MEDIUM' THEN -- Do Something-- Do Something WHEN ‘UNPOPULAR' THENWHEN ‘UNPOPULAR' THEN -- Do Something-- Do SomethingEND CASE;END CASE;

IF l_continue OR fn_rec_count > 10 THENIF l_continue OR fn_rec_count > 10 THEN -- Do Something-- Do SomethingEND IF;END IF;

IF l_continue AND fn_rec_count > 10 THENIF l_continue AND fn_rec_count > 10 THEN -- Do Something-- Do SomethingEND IF;END IF;

Page 8: Http:// Boost Performance with PL/SQL Programming Best Practices Tim Hall Oracle ACE Director Oracle ACE of the Year 2006 OCP DBA (7,

http://www.oracle-base.com

Declarations in LoopsDeclarations in Loops

• Code within loops gets run Code within loops gets run multiple times.multiple times.

• Variable declarations and Variable declarations and procedure/function calls in loops procedure/function calls in loops impact on performance.impact on performance.

• Simplify code within loops to Simplify code within loops to improve performance.improve performance.

• Oracle 11g offsets solves some of Oracle 11g offsets solves some of the performance impact with the performance impact with automatic subprogram inlining.automatic subprogram inlining.

• Don’t stop using modular code Don’t stop using modular code because of this. Keep these because of this. Keep these results in context!results in context!

-- Bad idea.-- Bad idea.FOR i IN 1 .. 100 LOOPFOR i IN 1 .. 100 LOOP DECLAREDECLARE l_str VARCHAR2(200);l_str VARCHAR2(200); BEGINBEGIN -- Do Something.-- Do Something. END; END; END LOOP;END LOOP;

-- Better idea.-- Better idea.DECLAREDECLARE l_str VARCHAR2(200);l_str VARCHAR2(200);BEGINBEGIN FOR i IN 1 .. 100 LOOPFOR i IN 1 .. 100 LOOP -- Do Something.-- Do Something. END LOOP;END LOOP;END;END;

Page 9: Http:// Boost Performance with PL/SQL Programming Best Practices Tim Hall Oracle ACE Director Oracle ACE of the Year 2006 OCP DBA (7,

http://www.oracle-base.com

Efficient Function CallsEfficient Function Calls

• When functions are called in When functions are called in SQL statements, minimize the SQL statements, minimize the number of calls by filtering the number of calls by filtering the data if possible.data if possible.

• DemoDemo• When function calls are When function calls are

present in the WHERE clause, present in the WHERE clause, consider function-based consider function-based indexes.indexes.

• DemoDemo• Consider maintenance costs, Consider maintenance costs,

disk space requirements and disk space requirements and global affect of function-based global affect of function-based indexes.indexes.

SELECT SQRT(num_val), COUNT(*) AS amountSELECT SQRT(num_val), COUNT(*) AS amountFROM tab1FROM tab1GROUP BY SQRT(num_val);GROUP BY SQRT(num_val);

SELECT SQRT(num_val), amountSELECT SQRT(num_val), amountFROM (SELECT num_val, COUNT(*) AS amountFROM (SELECT num_val, COUNT(*) AS amount FROM tab1FROM tab1 GROUP BY num_val))GROUP BY num_val))

CREATE INDEX efficient_functions_fbidxCREATE INDEX efficient_functions_fbidxON efficient_functions (SQRT(data_length));ON efficient_functions (SQRT(data_length));

SELECT COUNT(*)SELECT COUNT(*)FROM efficient_functions efFROM efficient_functions efWHERE SQRT(ef.data_length) = 5.47722558;WHERE SQRT(ef.data_length) = 5.47722558;

Page 10: Http:// Boost Performance with PL/SQL Programming Best Practices Tim Hall Oracle ACE Director Oracle ACE of the Year 2006 OCP DBA (7,

http://www.oracle-base.com

Using the NOCOPY HintUsing the NOCOPY Hint

• The NOCOPY hint allows OUT and IN OUT parameter to be The NOCOPY hint allows OUT and IN OUT parameter to be passed by-reference, rather than by-value.passed by-reference, rather than by-value.

• By-value: Procedure uses temporary buffer. Copies value back By-value: Procedure uses temporary buffer. Copies value back on successful completion.on successful completion.

• By-reference: Procedure uses original memory location directly.By-reference: Procedure uses original memory location directly.• Beware of affect of error handling and parameter aliasing on Beware of affect of error handling and parameter aliasing on

parameter values.parameter values.• It’s a hint, not a directive, so it can be ignoredIt’s a hint, not a directive, so it can be ignored

PROCEDURE myproc (p_tab IN OUT NOCOPY CLOB) ISPROCEDURE myproc (p_tab IN OUT NOCOPY CLOB) ISBEGINBEGIN -- Do something.-- Do something.END;END;

Page 11: Http:// Boost Performance with PL/SQL Programming Best Practices Tim Hall Oracle ACE Director Oracle ACE of the Year 2006 OCP DBA (7,

http://www.oracle-base.com

PLSQL_OPTIMIZE_LEVELPLSQL_OPTIMIZE_LEVEL

• The PLSQL_OPTIMIZE_LEVEL parameter was introduced in The PLSQL_OPTIMIZE_LEVEL parameter was introduced in 10g to control how much optimization the compiler performs:10g to control how much optimization the compiler performs:– 0 : Code will compile and run in a similar way to 9i and earlier. New 0 : Code will compile and run in a similar way to 9i and earlier. New

actions of BINARY_INTEGER and implicit array processing lost.actions of BINARY_INTEGER and implicit array processing lost.

– 1 : Performs a variety of optimizations, including elimination of 1 : Performs a variety of optimizations, including elimination of unnecessary computations and exceptions. Does not alter source unnecessary computations and exceptions. Does not alter source order.order.

– 2 : Performs additional optimizations, including reordering source 2 : Performs additional optimizations, including reordering source code if necessary. The is the default setting in 10g and 11g.code if necessary. The is the default setting in 10g and 11g.

– 3 : New in 11g. Yet more optimizations and subprogram inlining.3 : New in 11g. Yet more optimizations and subprogram inlining.

• The optimization level associated with the library unit is visible The optimization level associated with the library unit is visible using the %_PLSQL_OBJECT_SETTINGS view.using the %_PLSQL_OBJECT_SETTINGS view.

• Adjust only if package load times are adversely affected.Adjust only if package load times are adversely affected.ALTER SESSION SET PLSQL_OPTIMIZE_LEVEL=0;ALTER SESSION SET PLSQL_OPTIMIZE_LEVEL=0;ALTER PROCEDURE my_big_package COMPILE;ALTER PROCEDURE my_big_package COMPILE;

Page 12: Http:// Boost Performance with PL/SQL Programming Best Practices Tim Hall Oracle ACE Director Oracle ACE of the Year 2006 OCP DBA (7,

http://www.oracle-base.com

Conditional CompilationConditional Compilation

• Conditional compilation was introduced Conditional compilation was introduced in 10g to allow source to be tailored to in 10g to allow source to be tailored to specific environments using compiler specific environments using compiler directives.directives.

• Compiler flags are identified by the “$$” Compiler flags are identified by the “$$” prefix. Conditional control is provided by prefix. Conditional control is provided by the $IF-$THEN-$ELSE-$END syntax.the $IF-$THEN-$ELSE-$END syntax.

• The database source contains all the The database source contains all the directives, but the post-processed directives, but the post-processed source is displayed using the source is displayed using the DBMS_PREPROCESSOR package.DBMS_PREPROCESSOR package.

• The PLSQL_CCFLAGS clause is used to The PLSQL_CCFLAGS clause is used to set the compiler flags.set the compiler flags.

• The compiler flags associated with the The compiler flags associated with the library unit is visible using the library unit is visible using the %_PLSQL_OBJECT_SETTINGS view.%_PLSQL_OBJECT_SETTINGS view.

ALTER PROCEDURE debug COMPILEALTER PROCEDURE debug COMPILE PLSQL_CCFLAGS = 'debug_on:TRUE'PLSQL_CCFLAGS = 'debug_on:TRUE' REUSE SETTINGS;REUSE SETTINGS;

CREATE OR REPLACECREATE OR REPLACEPROCEDURE debug (p_text IN VARCHAR2)PROCEDURE debug (p_text IN VARCHAR2)ASAS $IF $$debug_on $THEN$IF $$debug_on $THEN l_text VARCHAR2(32767);l_text VARCHAR2(32767); $END$ENDBEGINBEGIN $IF $$debug_on $THEN$IF $$debug_on $THEN DBMS_OUTPUT.put_line(p_text);DBMS_OUTPUT.put_line(p_text); $ELSE$ELSE NULL;NULL; $END$ENDEND debug;END debug;

CREATE OR REPLACECREATE OR REPLACEPROCEDURE debug (p_text IN VARCHAR2)PROCEDURE debug (p_text IN VARCHAR2)ASAS l_text VARCHAR2(32767);l_text VARCHAR2(32767);BEGINBEGIN DBMS_OUTPUT.put_line(p_text);DBMS_OUTPUT.put_line(p_text);END debug;END debug;

CREATE OR REPLACECREATE OR REPLACEPROCEDURE debug (p_text IN VARCHAR2)PROCEDURE debug (p_text IN VARCHAR2)ASASBEGINBEGIN NULL;NULL;END debug;END debug;

Page 13: Http:// Boost Performance with PL/SQL Programming Best Practices Tim Hall Oracle ACE Director Oracle ACE of the Year 2006 OCP DBA (7,

http://www.oracle-base.com

Native Compilation of PL/SQL Native Compilation of PL/SQL

• By default PL/SQL is interpreted.By default PL/SQL is interpreted.• Set PLSQL_CODE_TYPE parameter to NATIVE before creating Set PLSQL_CODE_TYPE parameter to NATIVE before creating

or compiling code.or compiling code.

• Prior to 11g, native compilation converts PL/SQL to C, which is Prior to 11g, native compilation converts PL/SQL to C, which is then compiled in shared libraries.then compiled in shared libraries.

• Improves performance of procedural logic.Improves performance of procedural logic.• DemoDemo• Doesn’t affect the speed of database calls.Doesn’t affect the speed of database calls.• The PLSQL_CODE_TYPE associated with the library unit is visible The PLSQL_CODE_TYPE associated with the library unit is visible

using the %_PLSQL_OBJECT_SETTINGS view.using the %_PLSQL_OBJECT_SETTINGS view.

ALTER SESSION SET PLSQL_CODE_TYPE=NATIVE;ALTER SESSION SET PLSQL_CODE_TYPE=NATIVE;ALTER PROCEDURE my_proc COMPILE;ALTER PROCEDURE my_proc COMPILE;

Page 14: Http:// Boost Performance with PL/SQL Programming Best Practices Tim Hall Oracle ACE Director Oracle ACE of the Year 2006 OCP DBA (7,

http://www.oracle-base.com

INTEGER Types INTEGER Types

• NUMBER and it’s subtypes use an Oracle internal format, rather NUMBER and it’s subtypes use an Oracle internal format, rather than the machine arithmetic.than the machine arithmetic.

• INTEGER and other constrained type need additional runtime INTEGER and other constrained type need additional runtime checks compared to NUMBER.checks compared to NUMBER.

• PLS_INTEGER uses machine arithmetic to reduce overhead.PLS_INTEGER uses machine arithmetic to reduce overhead.• BINARY_INTEGER is slow in 8i and 9i, but fast in 10g because it BINARY_INTEGER is slow in 8i and 9i, but fast in 10g because it

uses machine arithmetic.uses machine arithmetic.• DemoDemo• 11g includes SIMPLE_INTEGER which is quick in natively 11g includes SIMPLE_INTEGER which is quick in natively

compiled code.compiled code.• Use the appropriate datatype for the job.Use the appropriate datatype for the job.

Page 15: Http:// Boost Performance with PL/SQL Programming Best Practices Tim Hall Oracle ACE Director Oracle ACE of the Year 2006 OCP DBA (7,

http://www.oracle-base.com

BINARY_FLOAT and BINARY_DOUBLE BINARY_FLOAT and BINARY_DOUBLE

• New in 10g.New in 10g.• They use machine arithmetic, like PLS_INTEGER and They use machine arithmetic, like PLS_INTEGER and

BINARY_INTEGER.BINARY_INTEGER.• Require less storage space.Require less storage space.• Fractional values not represented precisely, so avoid when Fractional values not represented precisely, so avoid when

accuracy is important.accuracy is important.• Approximately twice the speed of NUMBER.Approximately twice the speed of NUMBER.• DemoDemo• Use the appropriate datatype for the job. Use the appropriate datatype for the job.

Page 16: Http:// Boost Performance with PL/SQL Programming Best Practices Tim Hall Oracle ACE Director Oracle ACE of the Year 2006 OCP DBA (7,

http://www.oracle-base.com

Avoid unnecessary PL/SQLAvoid unnecessary PL/SQL

• SQL is usually quicker than PL/SQL.SQL is usually quicker than PL/SQL.• Don’t use UTL_FILE to read text files if you can use external Don’t use UTL_FILE to read text files if you can use external

tables.tables.• Don’t write PL/SQL merges if you can use the MERGE Don’t write PL/SQL merges if you can use the MERGE

statement.statement.• Use multi-table inserts, rather than coding them manually.Use multi-table inserts, rather than coding them manually.• Use DML error logging (Use DML error logging (DBMS_ERRLOGDBMS_ERRLOG) to trap failures in ) to trap failures in

DML, rather than coding PL/SQL.DML, rather than coding PL/SQL.• All use DML, which is easily parallelized.All use DML, which is easily parallelized.

Page 17: Http:// Boost Performance with PL/SQL Programming Best Practices Tim Hall Oracle ACE Director Oracle ACE of the Year 2006 OCP DBA (7,

http://www.oracle-base.com

Quick PointsQuick Points

• Use ROWIDs for update when data is selected for subsequent Use ROWIDs for update when data is selected for subsequent update.update.

• Use built-in functions where possible. They are usually more Use built-in functions where possible. They are usually more efficient that your custom code.efficient that your custom code.

• Datatype conversions take time. Reduce them.Datatype conversions take time. Reduce them.• Implicit cursors are faster and do more exception checking than Implicit cursors are faster and do more exception checking than

explicit cursors. Use them.explicit cursors. Use them.• Hide performance problems by decoupling. Queue requests and Hide performance problems by decoupling. Queue requests and

process in batch.process in batch.

Page 18: Http:// Boost Performance with PL/SQL Programming Best Practices Tim Hall Oracle ACE Director Oracle ACE of the Year 2006 OCP DBA (7,

http://www.oracle-base.com

Best Practices Summary Best Practices Summary

• Use bind variables to reduce the CPU and memory overheads associated with parsing Use bind variables to reduce the CPU and memory overheads associated with parsing similar statements multiple times.similar statements multiple times.

• Use bulk-binds.Use bulk-binds.• Order logical expressions and branching structures to increase the speed of code.Order logical expressions and branching structures to increase the speed of code.• Be mindful of the complexity of code blocks inside loops.Be mindful of the complexity of code blocks inside loops.• Reduce unnecessary function calls from SQL statements.Reduce unnecessary function calls from SQL statements.• Use the NOCOPY hint.Use the NOCOPY hint.• Use PLSQL_OPTIMIZE_LEVEL for performance improvements and decreased load times.Use PLSQL_OPTIMIZE_LEVEL for performance improvements and decreased load times.• Remove unnecessary code using conditional compilation.Remove unnecessary code using conditional compilation.• Natively compile PL/SQL to improve the speed of procedural code.Natively compile PL/SQL to improve the speed of procedural code.• Use PLS_INTEGER, BINARY_INTEGER, BINARY_FLOAT and BINARY_DOUBLE types Use PLS_INTEGER, BINARY_INTEGER, BINARY_FLOAT and BINARY_DOUBLE types

instead of internal numeric types.instead of internal numeric types.• Avoid unnecessary PL/SQL by using leaner equivalents.Avoid unnecessary PL/SQL by using leaner equivalents.• Improve record access speeds by using internal rowids rather than primary key searches.Improve record access speeds by using internal rowids rather than primary key searches.• Don’t duplicate functionality of built-in string functions.Don’t duplicate functionality of built-in string functions.• Minimize the number of datatype conversions.Minimize the number of datatype conversions.• Use of implicit rather than explicit cursors.Use of implicit rather than explicit cursors.• Hide performance problems from users by decoupling processes.Hide performance problems from users by decoupling processes.

Page 19: Http:// Boost Performance with PL/SQL Programming Best Practices Tim Hall Oracle ACE Director Oracle ACE of the Year 2006 OCP DBA (7,

http://www.oracle-base.com

The End… The End…

• Questions?Questions?• References: References:

http://www.oracle-base.comhttp://www.oracle-base.com

• Demos:Demos:http://www.oracle-base.com/workshops/plsql-best-practices/demos.ziphttp://www.oracle-base.com/workshops/plsql-best-practices/demos.zip