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.

182 CHAPTER 4 ■ PERFORMANCE MANAGEMENTPLAN_TABLE_OUTPUT-----------------------------------from hr.employeesorder by salary"15 rows selected.SQL>Now that you know that the execution plan includes the result cache, execute the actualquery, as shown here:SQL> select /*+ result_cache q_name(Query1) */last_name,salaryfrom hr.employeesorder by salary;When you first execute the query with the result_cache hint, the result_cache operatorchecks the server result cache to see whether it already contains the results for this query. If theresults are present there, of course, no execution is necessary and the query returns the resultsfrom the server result cache. In this example, since there are no prior results in the server resultcache (we actually purged the result cache before we issued our query), the first execution ofthe test query will execute the SQL statement and store the results in the server result cache.Execute the same statement again so it can use the cached results now. Query the V$RESULT_CACHE_STATISTICS view to examine the usage statistics for the new query:SQL> select name, value from v$result_cache_statistics;NAMEVALUE------------------------------------------- -------------Block Size (Bytes) 1024Block Count Maximum 384Block Count Current 32Result Size Maximum (Blocks) 19Create Count Success 1Create Count Failure 0Find Count 1Invalidation Count 0Delete Count Invalid 0Delete Count Valid 010 rows selected.SQL>

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

Saved successfully!

Ooh no, something went wrong!