User guide
Format
SET TRACELEVEL
<trace_level>
Sets the trace level, see Trace
for more
information.
SET SQLCACHE
<sqlcache_size>
Sets the SQL Statement cache size to the specified
value. A value of 0 disables SQL statement
caching.
The SET statements can be issued as a SQL statement in the following methods:
•
•
•
8.22 SQL Statement Cache
java.sql.Statement.execute
java.sql.Statement.executeUpdate
java.sql.Statement.executeQuery
Example
Statement stmt = conn.createStatement();
stmt.execute(set sqlcache 10);
When using the thin driver, performance may be improved by enabling SQL statement
caching.
Whenever the thin driver need to prepare a SQL statement, the statement must be sent over
the network to the server for Oracle Rdb to prepare the statement and send back a list of
columns or parameters that the statement references.
If the same SQL statement is prepared repeatedly during a single connection, without SQL
statement caching the statement will be prepared and column information sent back each
time. This can be time consuming because it requires network traffic, the preparation of the
statement, and getting the column and parameter information. These steps can be a
substantial part of the network I/O and performance cost of the queries.
To help reduce this cost, the thin driver allows you to cache SQL statements so that if the
exact same SQL string is prepared more than once during a single connected session, the cost
for the preparation and column information is only incurred once.
SQL statement caching can be enabled by using the sqlcache switch when you request a
connection either by placing the switch in the connection URL or using the information block
that is passed in the connect request.
134