Setting the statement cache

The statement cache lets Adaptive Server compare a newly received ad hoc SQL statement to cached SQL statements. If a match is found, Adaptive Server uses the plan cached from the initial execution. In this way, Adaptive Server does not have to recompile SQL statements for which it already has a plan.

The statement cache is a server-wide resource, which allocates and consumes memory from the procedure cache memory pool. Set the size of the statement cache dynamically using the statement cache size configuration parameter.

NoteIf you deallocate or reduce the amount of memory for the statement cache, the original memory allocated is not released until you restart Adaptive Server.

The syntax is as follows, where size_of_cache is the size, in 2K pages:

sp_configure "statement cache size", size_of_cache

For example, to set your statement cache to 5000 2K pages, enter:

sp_configure "statement cache size", 5000

See Chapter 5, “Setting Configuration Parameters,” in the System Administration Guide: Volume 1.

When you configure memory for the statement cache, consider: