SET STATEMENT CACHE statement
Use the SET STATEMENT CACHE statement to turn on caching or turn off caching for the current session. This statement is an extension to the ANSI/ISO standard for SQL.
Syntax
SET STATEMENT CACHE
{
ON
| OFF
}
Usage
You can use the SET STATEMENT CACHE statement to turn caching in the SQL statement cache ON or OFF for the current session. The statement cache stores in a buffer identical statements that are repeatedly run in a session. Only data manipulation language (DML) statements (DELETE, INSERT, UPDATE, or SELECT) can be stored in the statement cache.
This mechanism allows qualifying statements to bypass the optimization stage, and avoid recompiling, which can reduce memory consumption and can improve query processing time.
Examples
The
following example turns on statement caching for the current session:
SET STATEMENT CACHE ON;
The
following turns off statement caching for the current session: SET STATEMENT CACHE OFF;