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.

CHAPTER 4 ■ PERFORMANCE MANAGEMENT 189SQL queries, the client simply gets the results from the client cache directly, saving unnecessaryround-trips between the client and the server. Increased scalability results from the lower CPUusage. <strong>Oracle</strong>’s benchmark studies show that for simple queries such as the ones that use lookuptables, involving usually a read but not a write, performance gains could be dramatic, as highas a 500 percent reduction in elapsed time and a 200 percent drop in CPU time.■Note You must use <strong>Oracle</strong> <strong>Database</strong> <strong>11</strong>g client libraries and connect to an <strong>Oracle</strong> <strong>Database</strong> Release 1(<strong>11</strong>.1) or newer server to take advantage of the client-side query cache feature.Queries from different client sessions that have a match in things such as their SQL textand bind values share the cached query result sets. This leads to a significant reduction inresponse time for frequently executed SQL queries as well as an increase in scalability.The best aspect of the client cache feature is that you don’t have to make any changes toyour application code to take advantage of it. Any application that uses an <strong>Oracle</strong> <strong>Database</strong> <strong>11</strong>gOCI client can avail of the client cache. The OCI clients include ODBC, ODB.NET, PHP, JDBC-OCI(Thick) Driver, and various <strong>Oracle</strong> precompilers.The OCI client cache is particularly suitable for queries involving lookup tables that producerepeatable result sets or small static result sets. This type of caching is also ideal for frequentlyexecuted queries. Once you enable client result caching, the result can be cached on the clientor on the server. When you think the results aren’t consistent any longer or simply incorrect,you can disable the client caching feature.The Mechanics of Query Result Set CachingYou use the following two new initialization parameters to configure the client result cache:• client_result_cache_size: You can turn on client result caching by setting this parameterto a value greater than zero. The parameter sets the maximum size of the client per-processresult cache size in bytes. By default, the parameter has a value of zero, meaning theclient cache is disabled by default (in contrast, the server cache is enabled by default).The value of this parameter (in bytes) sets the limit on the result set cache for each clientprocess. The database assigns all OCI client processes a result cache that is equal to thevalue of this parameter. The client_result_cache_size parameter ranges from a minimumvalue of 0 to a maximum value that’s dependent on the operating system. You must restartthe database after setting the initial value for this parameter or after making an adjustment,since it’s a static initialization parameter. You can override the client_result_cache_sizeparameter with the client configuration parameter oci_result_cache_max_size.• client_result_cache_lag: This parameter sets the maximum time since the latest roundtripto the server after which the OCI client query makes a fresh round-trip to get newdata for the cached queries on the client.You can also use an optional client configuration file (or make the settings part of thesqlnet.ora file on the client) to enable and disable OCI client caching for OCI client processesthat use the file. The settings in the client configuration file override the client cache settingsmade through the server parameter file on the server. Any OCI client process that uses the

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

Saved successfully!

Ooh no, something went wrong!