11.07.2015 Views

Oracle Database 11 g - Online Public Access Catalog

Oracle Database 11 g - Online Public Access Catalog

Oracle Database 11 g - Online Public Access Catalog

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

188 CHAPTER 4 ■ PERFORMANCE MANAGEMENTSQL> select dept_name, count_emp(dept_id) "employee count"from deptswhere dept_name='Accounting';DEPARTMENT_NAMEEMPLOYEE_COUNT----------------- -------------------------Accounting 2SQL>When you issue the previous SQL query for the first time, it invokes the PL/SQL functionand stores the results it retrieves in the result cache. When you subsequently execute the samequery, it’ll simply retrieve the results directly from the result cache. You can examine theV$RESULT_CACHE_STATISTICS view, as in the case of the SQL query cache, to view the usagestatistics for the PL/SQL result cache. All columns such as create count success and find counthold the same meaning for the PL/SQL result cache, as they did for the SQL query result cache.If you apply a code patch to a PL/SQL unit such as a procedure, then the results in the PL/SQLresult cache won’t reflect the correct results for that PL/SQL unit, unless you bounce the instance.In cases such as these, you can bypass the result cache, as shown here:1. Place the result cache in bypass mode:SQL> exec dbms_result_cache.bypass(true)PL/SQL procedure successfully completed.2. Flush the existing cached results:SQL> exec dbms_result_cache.flushPL/SQL procedure successfully completed.3. Apply the PL/SQL code patch.4. Turn off the PL/SQL result cache bypass mode:SQL> exec dbms_result_cache.bypass(false)PL/SQL procedure successfully completed.When you turn result cache bypassing on, the database doesn’t use any cached results,and no results are stored there until you turn bypass mode off. Please refer to Chapter <strong>11</strong> for amore programmatic discussion of the PL/SQL cross-section result cache, as well as a listing ofthe limitations of the cache.OCI Consistent Client CacheThe OCI consistent client cache, also called simply the client cache, extends server-side querycaching by letting the client machines leverage their memory to cache query results. The clientcache resides in the OCI client process memory and can store tables or entire data sets, usuallyon the application server. Instead of having the server repeatedly execute frequently used

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!