SlideShare a Scribd company logo
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Oracle PL/SQL Performance Features
The Amazing and Elegant
PL/SQL Function Result Cache
Steven Feuerstein
Oracle Developer Advocate for PL/SQL
Oracle Corporation
Email: steven.feuerstein@oracle.com
Twitter: @sfonplsql
Blog: stevenfeuersteinonplsql.blogspot.com
YouTube: Practically Perfect PL/SQL
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Resources for Oracle Database Developers
• Official home of PL/SQL - oracle.com/plsql
• SQL-PL/SQL discussion forum on OTN
https://community.oracle.com/community/database/developer-tools/sql_and_pl_sql
• PL/SQL and EBR blog by Bryn Llewellyn - https://blogs.oracle.com/plsql-and-ebr
• Oracle Learning Library - oracle.com/oll
• Weekly PL/SQL and SQL quizzes, and more - plsqlchallenge.oracle.com
• Ask Tom - asktom.oracle.com – 'nuff said
• LiveSQL - livesql.oracle.com – script repository and 12/7 12c database
• oracle-developer.net - great content from Adrian Billington
• oracle-base.com - great content from Tim Hall
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
What's wrong with this picture?
• .
SELECT * FROM materialized_view
WHERE pky = 12345;
What's Taking So Long?
SELECT * FROM materialized_view
WHERE pky = 12345;
What's Taking So Long?
SELECT * FROM materialized_view
WHERE pky = 12345;
What's Taking So Long?
SELECT * FROM materialized_view
WHERE pky = 12345;
What's Taking So Long?
SELECT * FROM materialized_view
WHERE pky = 12345;
What's Taking So Long?
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Data Caching Options in PL/SQL
• Caching is a time-honored technique for improving performance.
• Store data that doesn’t change for some period of time in a location that
can be accessed more quickly than the source.
• The SGA is an enormous, complex cache for the entire database instance.
• But there are other caches we can leverage in our PL/SQL code.
– Deterministic functions
– PGA caching using package-level variables
– The function result cache: the most powerful and widely applicable technique
All referenced code available in my demo.zip file from the
PL/SQL Learning Library: oracle.com/oll/plsql.
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
System Global Area (SGA) of RDBMS Instance
PL/SQL Runtime Memory Architecture
Shared Pool
Large Pool
Reserved Pool
show_empscalc_totals upd_salaries
Select *
from emp
Shared SQL
Pre-parsed
Update emp
Set sal=...
Library cache
Session 1 memory
UGA – User Global Area
PGA – Process Global Area
emp_rec emp%rowtype;
tot_tab pkg.tottabtype;
Session 2 memory
UGA – User Global Area
PGA – Process Global Area
emp_rec emp%rowtype;
tot_tab pkg.tottabtype;Session 1 Session 2
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
How PL/SQL uses the SGA, PGA and UGA
• The SGA contains information that can be shared across sessions
connected to the instance.
– In PL/SQL, this is limited to package static constants.
• The User Global Area contains session-specific data that persists across
server call boundaries
– Package-level data
• The Process Global Area contains session-specific data that is released
when the current server call terminates: "local" data.
PACKAGE Pkg is /* 11g feature! */
Nonstatic_Constant CONSTANT PLS_INTEGER := My_Sequence.Nextval;
Static_Constant CONSTANT PLS_INTEGER := 42;
END Pkg;
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Data Caching Options
• Functions declared as DETERMINISTIC
• PGA caching
– Used most effectively with collections
– Accessing PGA memory generally more efficient than SGA, especially if executing SQL.
• Oracle Database 11g Function Result Cache
– The best caching technique and the most important new feature in 11g for PL/SQL
developers.
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
DETERMINSTIC Functions
• A function is deterministic if the value it returns is determined completely
by its inputs (IN arguments).
– In other words, no side effects.
• Add the DETERMINISTIC keyword to your function to enable
optimizations:
– Function-based indexes
– Cache results in scope of a query
• Don’t lie!
– Oracle will not (at compile time) reject your use of the keyword, even if it isn’t true.
deterministic.sql
deterministic_in_plsql.sql
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
PGA-Based Caching
• When you declare variables at the package level, their state persists in your
session.
– A PGA-based cache, specific to each session.
• And if you declare a collection at the package level, you can cache multiple
rows of data.
– Very useful for static datasets like materialized views.
• Not a reliable technique for Web-based (usually stateless) applications
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Avoiding Unnecessary SGA Lookups
First access
PGA
Function
Database
/ SGA
Not in cache;
Request data
from database
Pass Data
to Cache
Application
Application
Requests Data
Data retrieved
from cache Data returned
to application
Function
PGA
Subsequent accesses
Application
Application
Requests Data
Data returned
to application
Data retrieved
from cache
Database
/ SGA
Data found in
cache. Database
is not needed.
emplu.pkg / emplu.tst
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
PGA Caching: Things to keep in mind
• Must use package-level data so that it persists.
– Memory is consumed by the PGA and so is multiplied for all users of the application.
– Not a reliable technique for stateless application (Internet)
• Very difficult to share cache across sessions in the same instance.
– One possibility involves DBMS_PIPE.
• Very difficult to update the cache once the data source is changed.
– Especially by/from, other sessions. Possible to use DBMS_ALERT.
• Useful under specific scenarios....
– Small, static dataset or a single or small number of batch processes
syscache.pkg
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
The Function Result Cache
• Introduced in Oracle Database 11g, the Function Result Cache is
definitely the caching mechanism of choice for PL/SQL developers.
• This cache is stored in the SGA ; shared across sessions; purged of dirty
data automatically
• You can and should use it to retrieve data from any table that is queried
more frequently than updated.
– Static datasets like materialized views
– Same rows fetched multiple times (parameter values serve as unique index into
cache)
• Enterprise Edition only.
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
How the Function Result Cache Works
• Add the RESULT_CACHE clause to your function's header.
• When a call is made to function, Oracle compares IN argument values to
the cache.
• If no match, the function is executed and the inputs and return data are
cached.
• If a match is found, the function is not executed; cached data is returned.
• If changes to a "relies on" table are committed, the cache is marked
invalid and will be re-built.
11g_frc_demo.sql
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Minimal Impact on Code with Result Cache
• Add RESULT_CACHE keyword to header of function in both specification and body.
• RELIES_ON clause is deprecated in 11.2. Oracle will automatically determine all tables
on which the function relies. RELIES_ON is then ignored.
CREATE OR REPLACE PACKAGE emplu11g
IS
FUNCTION onerow (employee_id_in IN employees.employee_id%TYPE)
RETURN employees%ROWTYPE
RESULT_CACHE;
END emplu11g;
CREATE OR REPLACE PACKAGE BODY emplu11g
IS
FUNCTION onerow (employee_id_in IN employees.employee_id%TYPE)
RETURN employees%ROWTYPE
RESULT_CACHE RELIES_ON (employees)
IS
....
END onerow;
END emplu11g;
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Performance Impact of Result Cache
• The result cache is stored in the SGA.
• So we should expect it be slower than a PGA-based cache.
• But accessing result cache data does not require going through the SQL
engine.
• So it should be much faster than executing a query.
– Even if the statement is parsed and the data blocks are already in the SGA.
• Let's find out!
11g_emplu*.*
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Result Cache – Things to Keep in Mind - 1
• If you have uncommitted changes in your session, dependent caches are
ignored.
– The cache will not override your own changed data.
• Caching is not performed for complex types: records with CLOBs,
collections, etc.
– But Oracle is optimistic!
• The cache is not related to SQL statements in your function.
– It only keeps track of the input values and the RETURN clause data.
11g_frc_demo.sql
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Result Cache – Things to Keep in Mind - 2
• You cannot use the result cache with invoker rights program units until 12.1.
– Bypass execution of function body, Oracle cannot resolve references to objects - the
whole point of IR.
• Functions with session-specific dependencies must be "result-cached" with
great care.
– Virtual private database configurations
– References to SYSDATE, reliance on NLS_DATE_FORMAT, time zone changes
– Application contexts (calls to SYS_CONTEXT)
• Solution: move all dependencies into parameter list.
11g_frc_vpd.sql
11g_frc_vpd2.sql
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Managing the Result Cache
• Oracle offers a number of ways to manage the result cache and tune it to
your specific application needs:
• RESULT_CACHE_MAX_SIZE initialization parameter
– If the cache is too small, then the LRU algorithm negates the point of the cache.
• DBMS_RESULT_CACHE management package
• v$RESULT_CACHE_* performance views
show_frc_dependencies.sp
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Fine Grained Dependencies in 11.2
• Oracle keeps track of table dependencies on a per-result level.
– Each result cached could have a different set of dependencies.
• A change to a table could invalidate just a subset of the results in the
cache.
– It's not all or nothing - when your function's different logic paths could "hit" different
tables.
11g_frc_dependencies.sql
11g_frc_dependencies2.sql
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Make It Easy on Yourself
• I hope you will agree that the result cache is a great feature.
• But how easy will it be for you to apply it?
• If you write/duplicate queries throughout your code, upgrading will be
expensive and slow.
• If you hide your queries behind functions, you have a single point of
definition, and you can upgrade "instantly."
11g_frc_encapsulation.sql
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Conclusions - Caching
• Oracle offers several different ways you can build upon its own caching.
• DETERMINISTIC for functions in SQL
– Mostly useful for organizing code more effectively
• PGA caching
– Very fast, but of limited use
• Function result cache
– Simplest and most widely applicable technique
– Get ready for it now by hiding queries inside functions.
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted 22
The Amazing and Elegant PL/SQL Function Result Cache

More Related Content

What's hot

DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentals
DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentalsDB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentals
DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentals
John Beresniewicz
 
Cost Based Oracle Fundamentals
Cost Based Oracle FundamentalsCost Based Oracle Fundamentals
Cost Based Oracle Fundamentals
Juliana Maria Lopes
 
Explain the explain_plan
Explain the explain_planExplain the explain_plan
Explain the explain_plan
Maria Colgan
 
Ash masters : advanced ash analytics on Oracle
Ash masters : advanced ash analytics on Oracle Ash masters : advanced ash analytics on Oracle
Ash masters : advanced ash analytics on Oracle
Kyle Hailey
 
Your tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
Your tuning arsenal: AWR, ADDM, ASH, Metrics and AdvisorsYour tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
Your tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
John Kanagaraj
 
Performance Tuning With Oracle ASH and AWR. Part 1 How And What
Performance Tuning With Oracle ASH and AWR. Part 1 How And WhatPerformance Tuning With Oracle ASH and AWR. Part 1 How And What
Performance Tuning With Oracle ASH and AWR. Part 1 How And What
udaymoogala
 
Oracle RAC 12c Practical Performance Management and Tuning OOW13 [CON8825]
Oracle RAC 12c Practical Performance Management and Tuning OOW13 [CON8825]Oracle RAC 12c Practical Performance Management and Tuning OOW13 [CON8825]
Oracle RAC 12c Practical Performance Management and Tuning OOW13 [CON8825]
Markus Michalewicz
 
MySQL Performance Schema in MySQL 8.0
MySQL Performance Schema in MySQL 8.0MySQL Performance Schema in MySQL 8.0
MySQL Performance Schema in MySQL 8.0
Mayank Prasad
 
Oracle sql high performance tuning
Oracle sql high performance tuningOracle sql high performance tuning
Oracle sql high performance tuning
Guy Harrison
 
Tanel Poder - Scripts and Tools short
Tanel Poder - Scripts and Tools shortTanel Poder - Scripts and Tools short
Tanel Poder - Scripts and Tools short
Tanel Poder
 
Analyzing and Interpreting AWR
Analyzing and Interpreting AWRAnalyzing and Interpreting AWR
Analyzing and Interpreting AWR
pasalapudi
 
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
 
Troubleshooting Complex Oracle Performance Problems with Tanel Poder
Troubleshooting Complex Oracle Performance Problems with Tanel PoderTroubleshooting Complex Oracle Performance Problems with Tanel Poder
Troubleshooting Complex Oracle Performance Problems with Tanel Poder
Tanel Poder
 
Ash and awr deep dive hotsos
Ash and awr deep dive hotsosAsh and awr deep dive hotsos
Ash and awr deep dive hotsos
Kellyn Pot'Vin-Gorman
 
Advanced PLSQL Optimizing for Better Performance
Advanced PLSQL Optimizing for Better PerformanceAdvanced PLSQL Optimizing for Better Performance
Advanced PLSQL Optimizing for Better Performance
Zohar Elkayam
 
Exploring Oracle Database Performance Tuning Best Practices for DBAs and Deve...
Exploring Oracle Database Performance Tuning Best Practices for DBAs and Deve...Exploring Oracle Database Performance Tuning Best Practices for DBAs and Deve...
Exploring Oracle Database Performance Tuning Best Practices for DBAs and Deve...
Aaron Shilo
 
Tanel Poder Oracle Scripts and Tools (2010)
Tanel Poder Oracle Scripts and Tools (2010)Tanel Poder Oracle Scripts and Tools (2010)
Tanel Poder Oracle Scripts and Tools (2010)
Tanel Poder
 
Oracle GoldenGate 21c New Features and Best Practices
Oracle GoldenGate 21c New Features and Best PracticesOracle GoldenGate 21c New Features and Best Practices
Oracle GoldenGate 21c New Features and Best Practices
Bobby Curtis
 
APEX Connect 2019 - SQL Tuning 101
APEX Connect 2019 - SQL Tuning 101APEX Connect 2019 - SQL Tuning 101
APEX Connect 2019 - SQL Tuning 101
Connor McDonald
 
Oracle db performance tuning
Oracle db performance tuningOracle db performance tuning
Oracle db performance tuning
Simon Huang
 

What's hot (20)

DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentals
DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentalsDB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentals
DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentals
 
Cost Based Oracle Fundamentals
Cost Based Oracle FundamentalsCost Based Oracle Fundamentals
Cost Based Oracle Fundamentals
 
Explain the explain_plan
Explain the explain_planExplain the explain_plan
Explain the explain_plan
 
Ash masters : advanced ash analytics on Oracle
Ash masters : advanced ash analytics on Oracle Ash masters : advanced ash analytics on Oracle
Ash masters : advanced ash analytics on Oracle
 
Your tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
Your tuning arsenal: AWR, ADDM, ASH, Metrics and AdvisorsYour tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
Your tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
 
Performance Tuning With Oracle ASH and AWR. Part 1 How And What
Performance Tuning With Oracle ASH and AWR. Part 1 How And WhatPerformance Tuning With Oracle ASH and AWR. Part 1 How And What
Performance Tuning With Oracle ASH and AWR. Part 1 How And What
 
Oracle RAC 12c Practical Performance Management and Tuning OOW13 [CON8825]
Oracle RAC 12c Practical Performance Management and Tuning OOW13 [CON8825]Oracle RAC 12c Practical Performance Management and Tuning OOW13 [CON8825]
Oracle RAC 12c Practical Performance Management and Tuning OOW13 [CON8825]
 
MySQL Performance Schema in MySQL 8.0
MySQL Performance Schema in MySQL 8.0MySQL Performance Schema in MySQL 8.0
MySQL Performance Schema in MySQL 8.0
 
Oracle sql high performance tuning
Oracle sql high performance tuningOracle sql high performance tuning
Oracle sql high performance tuning
 
Tanel Poder - Scripts and Tools short
Tanel Poder - Scripts and Tools shortTanel Poder - Scripts and Tools short
Tanel Poder - Scripts and Tools short
 
Analyzing and Interpreting AWR
Analyzing and Interpreting AWRAnalyzing and Interpreting AWR
Analyzing and Interpreting AWR
 
Top 10 Oracle SQL tuning tips
Top 10 Oracle SQL tuning tipsTop 10 Oracle SQL tuning tips
Top 10 Oracle SQL tuning tips
 
Troubleshooting Complex Oracle Performance Problems with Tanel Poder
Troubleshooting Complex Oracle Performance Problems with Tanel PoderTroubleshooting Complex Oracle Performance Problems with Tanel Poder
Troubleshooting Complex Oracle Performance Problems with Tanel Poder
 
Ash and awr deep dive hotsos
Ash and awr deep dive hotsosAsh and awr deep dive hotsos
Ash and awr deep dive hotsos
 
Advanced PLSQL Optimizing for Better Performance
Advanced PLSQL Optimizing for Better PerformanceAdvanced PLSQL Optimizing for Better Performance
Advanced PLSQL Optimizing for Better Performance
 
Exploring Oracle Database Performance Tuning Best Practices for DBAs and Deve...
Exploring Oracle Database Performance Tuning Best Practices for DBAs and Deve...Exploring Oracle Database Performance Tuning Best Practices for DBAs and Deve...
Exploring Oracle Database Performance Tuning Best Practices for DBAs and Deve...
 
Tanel Poder Oracle Scripts and Tools (2010)
Tanel Poder Oracle Scripts and Tools (2010)Tanel Poder Oracle Scripts and Tools (2010)
Tanel Poder Oracle Scripts and Tools (2010)
 
Oracle GoldenGate 21c New Features and Best Practices
Oracle GoldenGate 21c New Features and Best PracticesOracle GoldenGate 21c New Features and Best Practices
Oracle GoldenGate 21c New Features and Best Practices
 
APEX Connect 2019 - SQL Tuning 101
APEX Connect 2019 - SQL Tuning 101APEX Connect 2019 - SQL Tuning 101
APEX Connect 2019 - SQL Tuning 101
 
Oracle db performance tuning
Oracle db performance tuningOracle db performance tuning
Oracle db performance tuning
 

Viewers also liked

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
 
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
 
Oracle Unit Testing with utPLSQL
Oracle Unit Testing with utPLSQLOracle Unit Testing with utPLSQL
Oracle Unit Testing with utPLSQL
Brendan Furey
 
PL/SQL Unit Testing Can Be Fun!
PL/SQL Unit Testing Can Be Fun!PL/SQL Unit Testing Can Be Fun!
PL/SQL Unit Testing Can Be Fun!
Raimonds Simanovskis
 
Artigo Jornal Económico "ValueKeep quer captar novas subscrições"
Artigo Jornal Económico  "ValueKeep quer captar novas subscrições"Artigo Jornal Económico  "ValueKeep quer captar novas subscrições"
Artigo Jornal Económico "ValueKeep quer captar novas subscrições"
Primavera Business Software Solutions SA
 
PL/SQL Unit Testing Can Be Fun
PL/SQL Unit Testing Can Be FunPL/SQL Unit Testing Can Be Fun
PL/SQL Unit Testing Can Be Fun
Raimonds Simanovskis
 
Eff Plsql
Eff PlsqlEff Plsql
Eff Plsql
afa reg
 
Date rangestech15
Date rangestech15Date rangestech15
Date rangestech15
stewashton
 
SQL for pattern matching (Oracle 12c)
SQL for pattern matching (Oracle 12c)SQL for pattern matching (Oracle 12c)
SQL for pattern matching (Oracle 12c)
Logan Palanisamy
 
PL/SQL All the Things in Oracle SQL Developer
PL/SQL All the Things in Oracle SQL DeveloperPL/SQL All the Things in Oracle SQL Developer
PL/SQL All the Things in Oracle SQL Developer
Jeff Smith
 
AMIS - Can collections speed up your PL/SQL?
AMIS - Can collections speed up your PL/SQL?AMIS - Can collections speed up your PL/SQL?
AMIS - Can collections speed up your PL/SQL?
Getting value from IoT, Integration and Data Analytics
 
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
 
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
 
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
 
Row Pattern Matching 12c MATCH_RECOGNIZE OOW14
Row Pattern Matching 12c MATCH_RECOGNIZE OOW14Row Pattern Matching 12c MATCH_RECOGNIZE OOW14
Row Pattern Matching 12c MATCH_RECOGNIZE OOW14
stewashton
 
PLSQL Standards and Best Practices
PLSQL Standards and Best PracticesPLSQL Standards and Best Practices
PLSQL Standards and Best Practices
Alwyn D'Souza
 

Viewers also liked (20)

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
 
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
 
Oracle Unit Testing with utPLSQL
Oracle Unit Testing with utPLSQLOracle Unit Testing with utPLSQL
Oracle Unit Testing with utPLSQL
 
PL/SQL Unit Testing Can Be Fun!
PL/SQL Unit Testing Can Be Fun!PL/SQL Unit Testing Can Be Fun!
PL/SQL Unit Testing Can Be Fun!
 
Artigo Jornal Económico "ValueKeep quer captar novas subscrições"
Artigo Jornal Económico  "ValueKeep quer captar novas subscrições"Artigo Jornal Económico  "ValueKeep quer captar novas subscrições"
Artigo Jornal Económico "ValueKeep quer captar novas subscrições"
 
PL/SQL Unit Testing Can Be Fun
PL/SQL Unit Testing Can Be FunPL/SQL Unit Testing Can Be Fun
PL/SQL Unit Testing Can Be Fun
 
Eff Plsql
Eff PlsqlEff Plsql
Eff Plsql
 
Date rangestech15
Date rangestech15Date rangestech15
Date rangestech15
 
SQL for pattern matching (Oracle 12c)
SQL for pattern matching (Oracle 12c)SQL for pattern matching (Oracle 12c)
SQL for pattern matching (Oracle 12c)
 
PL/SQL All the Things in Oracle SQL Developer
PL/SQL All the Things in Oracle SQL DeveloperPL/SQL All the Things in Oracle SQL Developer
PL/SQL All the Things in Oracle SQL Developer
 
AMIS - Can collections speed up your PL/SQL?
AMIS - Can collections speed up your PL/SQL?AMIS - Can collections speed up your PL/SQL?
AMIS - Can collections speed up your PL/SQL?
 
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
 
Oracle - SQL-PL/SQL context switching
Oracle - SQL-PL/SQL context switchingOracle - SQL-PL/SQL context switching
Oracle - SQL-PL/SQL context switching
 
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
 
Row Pattern Matching 12c MATCH_RECOGNIZE OOW14
Row Pattern Matching 12c MATCH_RECOGNIZE OOW14Row Pattern Matching 12c MATCH_RECOGNIZE OOW14
Row Pattern Matching 12c MATCH_RECOGNIZE OOW14
 
PLSQL Standards and Best Practices
PLSQL Standards and Best PracticesPLSQL Standards and Best Practices
PLSQL Standards and Best Practices
 

Similar to The Amazing and Elegant PL/SQL Function Result Cache

Exploring plsql new features best practices september 2013
Exploring plsql new features best practices   september 2013Exploring plsql new features best practices   september 2013
Exploring plsql new features best practices september 2013
Andrejs Vorobjovs
 
Developer day v2
Developer day v2Developer day v2
Developer day v2
AiougVizagChapter
 
01 oracle architecture
01 oracle architecture01 oracle architecture
01 oracle architecture
Smitha Padmanabhan
 
Best practices for large oracle apps r12 implementations apps14
Best practices for large oracle apps r12 implementations apps14Best practices for large oracle apps r12 implementations apps14
Best practices for large oracle apps r12 implementations apps14
Ajith Narayanan
 
MySql's NoSQL -- best of both worlds on the same disks
MySql's NoSQL -- best of both worlds on the same disksMySql's NoSQL -- best of both worlds on the same disks
MySql's NoSQL -- best of both worlds on the same disks
Dave Stokes
 
Migrating to Database 12c Multitenant - New Opportunities To Get It Right!
Migrating to Database 12c Multitenant - New Opportunities To Get It Right!Migrating to Database 12c Multitenant - New Opportunities To Get It Right!
Migrating to Database 12c Multitenant - New Opportunities To Get It Right!
Performance Tuning Corporation
 
MySQL 5.7 New Features to Exploit -- PHPTek/Chicago MySQL User Group May 2014
MySQL 5.7 New Features to Exploit -- PHPTek/Chicago MySQL User Group May 2014MySQL 5.7 New Features to Exploit -- PHPTek/Chicago MySQL User Group May 2014
MySQL 5.7 New Features to Exploit -- PHPTek/Chicago MySQL User Group May 2014
Dave Stokes
 
Oracle ADF Architecture TV - Development - Logging
Oracle ADF Architecture TV - Development - LoggingOracle ADF Architecture TV - Development - Logging
Oracle ADF Architecture TV - Development - Logging
Chris Muir
 
Ora 4 the_sqldba
Ora 4 the_sqldbaOra 4 the_sqldba
Ora 4 the_sqldba
Kellyn Pot'Vin-Gorman
 
MySQL Cluster Asynchronous replication (2014)
MySQL Cluster Asynchronous replication (2014) MySQL Cluster Asynchronous replication (2014)
MySQL Cluster Asynchronous replication (2014)
Frazer Clement
 
Con8780 nair rac_best_practices_final_without_12_2content
Con8780 nair rac_best_practices_final_without_12_2contentCon8780 nair rac_best_practices_final_without_12_2content
Con8780 nair rac_best_practices_final_without_12_2content
Anil Nair
 
MySQL 5.7 -- SCaLE Feb 2014
MySQL 5.7 -- SCaLE Feb 2014MySQL 5.7 -- SCaLE Feb 2014
MySQL 5.7 -- SCaLE Feb 2014
Dave Stokes
 
Oracle Database In-Memory Advisor (English)
Oracle Database In-Memory Advisor (English)Oracle Database In-Memory Advisor (English)
Oracle Database In-Memory Advisor (English)
Ileana Somesan
 
MySQL Manchester TT - Performance Tuning
MySQL Manchester TT  - Performance TuningMySQL Manchester TT  - Performance Tuning
MySQL Manchester TT - Performance Tuning
Mark Swarbrick
 
MySQL 5.7 NEW FEATURES, BETTER PERFORMANCE, AND THINGS THAT WILL BREAK -- Mid...
MySQL 5.7 NEW FEATURES, BETTER PERFORMANCE, AND THINGS THAT WILL BREAK -- Mid...MySQL 5.7 NEW FEATURES, BETTER PERFORMANCE, AND THINGS THAT WILL BREAK -- Mid...
MySQL 5.7 NEW FEATURES, BETTER PERFORMANCE, AND THINGS THAT WILL BREAK -- Mid...
Dave Stokes
 
MySQL NoSQL APIs
MySQL NoSQL APIsMySQL NoSQL APIs
MySQL NoSQL APIs
Morgan Tocker
 
20150110 my sql-performanceschema
20150110 my sql-performanceschema20150110 my sql-performanceschema
20150110 my sql-performanceschema
Ivan Ma
 
OUGLS 2016: Guided Tour On The MySQL Source Code
OUGLS 2016: Guided Tour On The MySQL Source CodeOUGLS 2016: Guided Tour On The MySQL Source Code
OUGLS 2016: Guided Tour On The MySQL Source Code
Georgi Kodinov
 
AWR and ASH Deep Dive
AWR and ASH Deep DiveAWR and ASH Deep Dive
AWR and ASH Deep Dive
Kellyn Pot'Vin-Gorman
 
Kellyn Pot'Vin-Gorman - Awr and Ash
Kellyn Pot'Vin-Gorman - Awr and AshKellyn Pot'Vin-Gorman - Awr and Ash
Kellyn Pot'Vin-Gorman - Awr and Ash
gaougorg
 

Similar to The Amazing and Elegant PL/SQL Function Result Cache (20)

Exploring plsql new features best practices september 2013
Exploring plsql new features best practices   september 2013Exploring plsql new features best practices   september 2013
Exploring plsql new features best practices september 2013
 
Developer day v2
Developer day v2Developer day v2
Developer day v2
 
01 oracle architecture
01 oracle architecture01 oracle architecture
01 oracle architecture
 
Best practices for large oracle apps r12 implementations apps14
Best practices for large oracle apps r12 implementations apps14Best practices for large oracle apps r12 implementations apps14
Best practices for large oracle apps r12 implementations apps14
 
MySql's NoSQL -- best of both worlds on the same disks
MySql's NoSQL -- best of both worlds on the same disksMySql's NoSQL -- best of both worlds on the same disks
MySql's NoSQL -- best of both worlds on the same disks
 
Migrating to Database 12c Multitenant - New Opportunities To Get It Right!
Migrating to Database 12c Multitenant - New Opportunities To Get It Right!Migrating to Database 12c Multitenant - New Opportunities To Get It Right!
Migrating to Database 12c Multitenant - New Opportunities To Get It Right!
 
MySQL 5.7 New Features to Exploit -- PHPTek/Chicago MySQL User Group May 2014
MySQL 5.7 New Features to Exploit -- PHPTek/Chicago MySQL User Group May 2014MySQL 5.7 New Features to Exploit -- PHPTek/Chicago MySQL User Group May 2014
MySQL 5.7 New Features to Exploit -- PHPTek/Chicago MySQL User Group May 2014
 
Oracle ADF Architecture TV - Development - Logging
Oracle ADF Architecture TV - Development - LoggingOracle ADF Architecture TV - Development - Logging
Oracle ADF Architecture TV - Development - Logging
 
Ora 4 the_sqldba
Ora 4 the_sqldbaOra 4 the_sqldba
Ora 4 the_sqldba
 
MySQL Cluster Asynchronous replication (2014)
MySQL Cluster Asynchronous replication (2014) MySQL Cluster Asynchronous replication (2014)
MySQL Cluster Asynchronous replication (2014)
 
Con8780 nair rac_best_practices_final_without_12_2content
Con8780 nair rac_best_practices_final_without_12_2contentCon8780 nair rac_best_practices_final_without_12_2content
Con8780 nair rac_best_practices_final_without_12_2content
 
MySQL 5.7 -- SCaLE Feb 2014
MySQL 5.7 -- SCaLE Feb 2014MySQL 5.7 -- SCaLE Feb 2014
MySQL 5.7 -- SCaLE Feb 2014
 
Oracle Database In-Memory Advisor (English)
Oracle Database In-Memory Advisor (English)Oracle Database In-Memory Advisor (English)
Oracle Database In-Memory Advisor (English)
 
MySQL Manchester TT - Performance Tuning
MySQL Manchester TT  - Performance TuningMySQL Manchester TT  - Performance Tuning
MySQL Manchester TT - Performance Tuning
 
MySQL 5.7 NEW FEATURES, BETTER PERFORMANCE, AND THINGS THAT WILL BREAK -- Mid...
MySQL 5.7 NEW FEATURES, BETTER PERFORMANCE, AND THINGS THAT WILL BREAK -- Mid...MySQL 5.7 NEW FEATURES, BETTER PERFORMANCE, AND THINGS THAT WILL BREAK -- Mid...
MySQL 5.7 NEW FEATURES, BETTER PERFORMANCE, AND THINGS THAT WILL BREAK -- Mid...
 
MySQL NoSQL APIs
MySQL NoSQL APIsMySQL NoSQL APIs
MySQL NoSQL APIs
 
20150110 my sql-performanceschema
20150110 my sql-performanceschema20150110 my sql-performanceschema
20150110 my sql-performanceschema
 
OUGLS 2016: Guided Tour On The MySQL Source Code
OUGLS 2016: Guided Tour On The MySQL Source CodeOUGLS 2016: Guided Tour On The MySQL Source Code
OUGLS 2016: Guided Tour On The MySQL Source Code
 
AWR and ASH Deep Dive
AWR and ASH Deep DiveAWR and ASH Deep Dive
AWR and ASH Deep Dive
 
Kellyn Pot'Vin-Gorman - Awr and Ash
Kellyn Pot'Vin-Gorman - Awr and AshKellyn Pot'Vin-Gorman - Awr and Ash
Kellyn Pot'Vin-Gorman - Awr and Ash
 

More from Steven Feuerstein

New(er) Stuff in PL/SQL
New(er) Stuff in PL/SQLNew(er) Stuff in PL/SQL
New(er) Stuff in PL/SQL
Steven Feuerstein
 
Six simple steps to unit testing happiness
Six simple steps to unit testing happinessSix simple steps to unit testing happiness
Six simple steps to unit testing happiness
Steven Feuerstein
 
Speakers at Nov 2019 PL/SQL Office Hours session
Speakers at Nov 2019 PL/SQL Office Hours sessionSpeakers at Nov 2019 PL/SQL Office Hours session
Speakers at Nov 2019 PL/SQL Office Hours session
Steven Feuerstein
 
New Stuff in the Oracle PL/SQL Language
New Stuff in the Oracle PL/SQL LanguageNew Stuff in the Oracle PL/SQL Language
New Stuff in the Oracle PL/SQL Language
Steven Feuerstein
 
AskTOM Office Hours on Database Triggers
AskTOM Office Hours on Database TriggersAskTOM Office Hours on Database Triggers
AskTOM Office Hours on Database Triggers
Steven Feuerstein
 
PL/SQL Guilty Pleasures
PL/SQL Guilty PleasuresPL/SQL Guilty Pleasures
PL/SQL Guilty Pleasures
Steven Feuerstein
 
Oracle Application Express and PL/SQL: a world-class combo
Oracle Application Express and PL/SQL: a world-class comboOracle Application Express and PL/SQL: a world-class combo
Oracle Application Express and PL/SQL: a world-class combo
Steven Feuerstein
 
OLD APEX and PL/SQL
OLD APEX and PL/SQLOLD APEX and PL/SQL
OLD APEX and PL/SQL
Steven Feuerstein
 
Oracle PL/SQL 12c and 18c New Features + RADstack + Community Sites
Oracle PL/SQL 12c and 18c New Features + RADstack + Community SitesOracle PL/SQL 12c and 18c New Features + RADstack + Community Sites
Oracle PL/SQL 12c and 18c New Features + RADstack + Community Sites
Steven Feuerstein
 
AskTOM Office Hours - Dynamic SQL in PL/SQL
AskTOM Office Hours - Dynamic SQL in PL/SQLAskTOM Office Hours - Dynamic SQL in PL/SQL
AskTOM Office Hours - Dynamic SQL in PL/SQL
Steven Feuerstein
 
Database Developers: the most important developers on earth?
Database Developers: the most important developers on earth?Database Developers: the most important developers on earth?
Database Developers: the most important developers on earth?
Steven Feuerstein
 

More from Steven Feuerstein (11)

New(er) Stuff in PL/SQL
New(er) Stuff in PL/SQLNew(er) Stuff in PL/SQL
New(er) Stuff in PL/SQL
 
Six simple steps to unit testing happiness
Six simple steps to unit testing happinessSix simple steps to unit testing happiness
Six simple steps to unit testing happiness
 
Speakers at Nov 2019 PL/SQL Office Hours session
Speakers at Nov 2019 PL/SQL Office Hours sessionSpeakers at Nov 2019 PL/SQL Office Hours session
Speakers at Nov 2019 PL/SQL Office Hours session
 
New Stuff in the Oracle PL/SQL Language
New Stuff in the Oracle PL/SQL LanguageNew Stuff in the Oracle PL/SQL Language
New Stuff in the Oracle PL/SQL Language
 
AskTOM Office Hours on Database Triggers
AskTOM Office Hours on Database TriggersAskTOM Office Hours on Database Triggers
AskTOM Office Hours on Database Triggers
 
PL/SQL Guilty Pleasures
PL/SQL Guilty PleasuresPL/SQL Guilty Pleasures
PL/SQL Guilty Pleasures
 
Oracle Application Express and PL/SQL: a world-class combo
Oracle Application Express and PL/SQL: a world-class comboOracle Application Express and PL/SQL: a world-class combo
Oracle Application Express and PL/SQL: a world-class combo
 
OLD APEX and PL/SQL
OLD APEX and PL/SQLOLD APEX and PL/SQL
OLD APEX and PL/SQL
 
Oracle PL/SQL 12c and 18c New Features + RADstack + Community Sites
Oracle PL/SQL 12c and 18c New Features + RADstack + Community SitesOracle PL/SQL 12c and 18c New Features + RADstack + Community Sites
Oracle PL/SQL 12c and 18c New Features + RADstack + Community Sites
 
AskTOM Office Hours - Dynamic SQL in PL/SQL
AskTOM Office Hours - Dynamic SQL in PL/SQLAskTOM Office Hours - Dynamic SQL in PL/SQL
AskTOM Office Hours - Dynamic SQL in PL/SQL
 
Database Developers: the most important developers on earth?
Database Developers: the most important developers on earth?Database Developers: the most important developers on earth?
Database Developers: the most important developers on earth?
 

Recently uploaded

Principle of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptxPrinciple of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptx
BibashShahi
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
Neo4j
 
Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
Ivo Velitchkov
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
Ajin Abraham
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
Antonios Katsarakis
 
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
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Precisely
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Neo4j
 
Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
c5vrf27qcz
 
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving
 
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
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
saastr
 
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
Alex Pruden
 
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
 
The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
operationspcvita
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 

Recently uploaded (20)

Principle of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptxPrinciple of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptx
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
 
Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
 
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...
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
 
Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
 
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
 
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...
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
 
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
 
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
 
The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 

The Amazing and Elegant PL/SQL Function Result Cache

  • 1. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Oracle PL/SQL Performance Features The Amazing and Elegant PL/SQL Function Result Cache Steven Feuerstein Oracle Developer Advocate for PL/SQL Oracle Corporation Email: steven.feuerstein@oracle.com Twitter: @sfonplsql Blog: stevenfeuersteinonplsql.blogspot.com YouTube: Practically Perfect PL/SQL
  • 2. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Resources for Oracle Database Developers • Official home of PL/SQL - oracle.com/plsql • SQL-PL/SQL discussion forum on OTN https://community.oracle.com/community/database/developer-tools/sql_and_pl_sql • PL/SQL and EBR blog by Bryn Llewellyn - https://blogs.oracle.com/plsql-and-ebr • Oracle Learning Library - oracle.com/oll • Weekly PL/SQL and SQL quizzes, and more - plsqlchallenge.oracle.com • Ask Tom - asktom.oracle.com – 'nuff said • LiveSQL - livesql.oracle.com – script repository and 12/7 12c database • oracle-developer.net - great content from Adrian Billington • oracle-base.com - great content from Tim Hall
  • 3. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | What's wrong with this picture? • . SELECT * FROM materialized_view WHERE pky = 12345; What's Taking So Long? SELECT * FROM materialized_view WHERE pky = 12345; What's Taking So Long? SELECT * FROM materialized_view WHERE pky = 12345; What's Taking So Long? SELECT * FROM materialized_view WHERE pky = 12345; What's Taking So Long? SELECT * FROM materialized_view WHERE pky = 12345; What's Taking So Long?
  • 4. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Data Caching Options in PL/SQL • Caching is a time-honored technique for improving performance. • Store data that doesn’t change for some period of time in a location that can be accessed more quickly than the source. • The SGA is an enormous, complex cache for the entire database instance. • But there are other caches we can leverage in our PL/SQL code. – Deterministic functions – PGA caching using package-level variables – The function result cache: the most powerful and widely applicable technique All referenced code available in my demo.zip file from the PL/SQL Learning Library: oracle.com/oll/plsql.
  • 5. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | System Global Area (SGA) of RDBMS Instance PL/SQL Runtime Memory Architecture Shared Pool Large Pool Reserved Pool show_empscalc_totals upd_salaries Select * from emp Shared SQL Pre-parsed Update emp Set sal=... Library cache Session 1 memory UGA – User Global Area PGA – Process Global Area emp_rec emp%rowtype; tot_tab pkg.tottabtype; Session 2 memory UGA – User Global Area PGA – Process Global Area emp_rec emp%rowtype; tot_tab pkg.tottabtype;Session 1 Session 2
  • 6. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | How PL/SQL uses the SGA, PGA and UGA • The SGA contains information that can be shared across sessions connected to the instance. – In PL/SQL, this is limited to package static constants. • The User Global Area contains session-specific data that persists across server call boundaries – Package-level data • The Process Global Area contains session-specific data that is released when the current server call terminates: "local" data. PACKAGE Pkg is /* 11g feature! */ Nonstatic_Constant CONSTANT PLS_INTEGER := My_Sequence.Nextval; Static_Constant CONSTANT PLS_INTEGER := 42; END Pkg;
  • 7. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Data Caching Options • Functions declared as DETERMINISTIC • PGA caching – Used most effectively with collections – Accessing PGA memory generally more efficient than SGA, especially if executing SQL. • Oracle Database 11g Function Result Cache – The best caching technique and the most important new feature in 11g for PL/SQL developers.
  • 8. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | DETERMINSTIC Functions • A function is deterministic if the value it returns is determined completely by its inputs (IN arguments). – In other words, no side effects. • Add the DETERMINISTIC keyword to your function to enable optimizations: – Function-based indexes – Cache results in scope of a query • Don’t lie! – Oracle will not (at compile time) reject your use of the keyword, even if it isn’t true. deterministic.sql deterministic_in_plsql.sql
  • 9. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | PGA-Based Caching • When you declare variables at the package level, their state persists in your session. – A PGA-based cache, specific to each session. • And if you declare a collection at the package level, you can cache multiple rows of data. – Very useful for static datasets like materialized views. • Not a reliable technique for Web-based (usually stateless) applications
  • 10. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Avoiding Unnecessary SGA Lookups First access PGA Function Database / SGA Not in cache; Request data from database Pass Data to Cache Application Application Requests Data Data retrieved from cache Data returned to application Function PGA Subsequent accesses Application Application Requests Data Data returned to application Data retrieved from cache Database / SGA Data found in cache. Database is not needed. emplu.pkg / emplu.tst
  • 11. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | PGA Caching: Things to keep in mind • Must use package-level data so that it persists. – Memory is consumed by the PGA and so is multiplied for all users of the application. – Not a reliable technique for stateless application (Internet) • Very difficult to share cache across sessions in the same instance. – One possibility involves DBMS_PIPE. • Very difficult to update the cache once the data source is changed. – Especially by/from, other sessions. Possible to use DBMS_ALERT. • Useful under specific scenarios.... – Small, static dataset or a single or small number of batch processes syscache.pkg
  • 12. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | The Function Result Cache • Introduced in Oracle Database 11g, the Function Result Cache is definitely the caching mechanism of choice for PL/SQL developers. • This cache is stored in the SGA ; shared across sessions; purged of dirty data automatically • You can and should use it to retrieve data from any table that is queried more frequently than updated. – Static datasets like materialized views – Same rows fetched multiple times (parameter values serve as unique index into cache) • Enterprise Edition only.
  • 13. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | How the Function Result Cache Works • Add the RESULT_CACHE clause to your function's header. • When a call is made to function, Oracle compares IN argument values to the cache. • If no match, the function is executed and the inputs and return data are cached. • If a match is found, the function is not executed; cached data is returned. • If changes to a "relies on" table are committed, the cache is marked invalid and will be re-built. 11g_frc_demo.sql
  • 14. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Minimal Impact on Code with Result Cache • Add RESULT_CACHE keyword to header of function in both specification and body. • RELIES_ON clause is deprecated in 11.2. Oracle will automatically determine all tables on which the function relies. RELIES_ON is then ignored. CREATE OR REPLACE PACKAGE emplu11g IS FUNCTION onerow (employee_id_in IN employees.employee_id%TYPE) RETURN employees%ROWTYPE RESULT_CACHE; END emplu11g; CREATE OR REPLACE PACKAGE BODY emplu11g IS FUNCTION onerow (employee_id_in IN employees.employee_id%TYPE) RETURN employees%ROWTYPE RESULT_CACHE RELIES_ON (employees) IS .... END onerow; END emplu11g;
  • 15. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Performance Impact of Result Cache • The result cache is stored in the SGA. • So we should expect it be slower than a PGA-based cache. • But accessing result cache data does not require going through the SQL engine. • So it should be much faster than executing a query. – Even if the statement is parsed and the data blocks are already in the SGA. • Let's find out! 11g_emplu*.*
  • 16. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Result Cache – Things to Keep in Mind - 1 • If you have uncommitted changes in your session, dependent caches are ignored. – The cache will not override your own changed data. • Caching is not performed for complex types: records with CLOBs, collections, etc. – But Oracle is optimistic! • The cache is not related to SQL statements in your function. – It only keeps track of the input values and the RETURN clause data. 11g_frc_demo.sql
  • 17. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Result Cache – Things to Keep in Mind - 2 • You cannot use the result cache with invoker rights program units until 12.1. – Bypass execution of function body, Oracle cannot resolve references to objects - the whole point of IR. • Functions with session-specific dependencies must be "result-cached" with great care. – Virtual private database configurations – References to SYSDATE, reliance on NLS_DATE_FORMAT, time zone changes – Application contexts (calls to SYS_CONTEXT) • Solution: move all dependencies into parameter list. 11g_frc_vpd.sql 11g_frc_vpd2.sql
  • 18. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Managing the Result Cache • Oracle offers a number of ways to manage the result cache and tune it to your specific application needs: • RESULT_CACHE_MAX_SIZE initialization parameter – If the cache is too small, then the LRU algorithm negates the point of the cache. • DBMS_RESULT_CACHE management package • v$RESULT_CACHE_* performance views show_frc_dependencies.sp
  • 19. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Fine Grained Dependencies in 11.2 • Oracle keeps track of table dependencies on a per-result level. – Each result cached could have a different set of dependencies. • A change to a table could invalidate just a subset of the results in the cache. – It's not all or nothing - when your function's different logic paths could "hit" different tables. 11g_frc_dependencies.sql 11g_frc_dependencies2.sql
  • 20. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Make It Easy on Yourself • I hope you will agree that the result cache is a great feature. • But how easy will it be for you to apply it? • If you write/duplicate queries throughout your code, upgrading will be expensive and slow. • If you hide your queries behind functions, you have a single point of definition, and you can upgrade "instantly." 11g_frc_encapsulation.sql
  • 21. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Conclusions - Caching • Oracle offers several different ways you can build upon its own caching. • DETERMINISTIC for functions in SQL – Mostly useful for organizing code more effectively • PGA caching – Very fast, but of limited use • Function result cache – Simplest and most widely applicable technique – Get ready for it now by hiding queries inside functions.
  • 22. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted 22