|
The SET PROCEDURES_CACHE statement specifies the amount of memory for an SQL session that the database engine reserves as a cache for stored procedures.
The value of megabytes can be any whole number in the range zero to approximately two billion. The database engine automatically defaults to 5 MB. Each session can change its amount of cache memory by issuing the SET statement.
The companion statement to SET PROCEDURES_CACHE is SET CACHED_PROCEDURES.
The following condition applies if you set PROCEDURES_CACHE to a nonzero value. The database engine removes the least-recently-used procedures from the cache if the execution of a procedure allocates memory that exceeds the PROCEDURES_CACHE value.
If a memory cache is used, it retains a compiled version of a stored procedure after the procedure executes. Typically, caching results in improved performance for each subsequent call to a cached procedure. Note that excessive memory swapping, or thrashing, could occur depending on the cache settings and the SQL being executed by your application. Thrashing can cause a decrease in performance.
In addition to the SET statement, the amount of memory reserved for the cache can be specified with a registry setting. The registry settings apply to all sessions and provides a convenient way to set an initial value. Each session can override the registry setting for that particular session by using the SET statement.
The registry setting applies to all server platforms on which Pervasive PSQL Server is supported. You must manually modify the registry setting. On Windows, use the registry editor provided with the operating system. On Linux, you can use the psregedit utility. On NetWare, use a text editor to modify SYS:ETC\PSRGSTRY.INI.
If the registry setting is not specified, the database engine automatically defaults to 5 MB.
To specify the amount of cache memory in a registry setting on Windows:
HKEY_LOCAL_MACHINE\SOFTWARE\Pervasive Software\SQL Relational Engine
Note
In most Windows operating systems, the `Pervasive Software' key isHKEY_LOCAL_MACHINE\SOFTWARE\PERVASIVE SOFTWARE. However, its location underHKEY_LOCAL_MACHINE\SOFTWAREcan vary depending on the operating system.
To specify the amount of cache memory in the Pervasive Registry (Linux or NetWare):
A stored procedure is not cached, regardless of the cache setting(s), for any of the following:
EXEC ('SELECT Student_ID FROM ' + :myinputvar).The following example sets a cache memory of 2 MB that stores up to 20 stored procedures.
The following example sets a cache memory of 1,000 MB that stores up to 500 stored procedures.
The following example specifies that you do not want to cache stored procedures and that any existing procedures cache will be removed.
The following example specifies that you want to set the amount of cache memory to 80 MB and ignore the number of procedures that may be cached.
(The database engine implicitly sets CACHED_PROCEDURES to zero.)
|
Chapter contents
Prev topic: SET PASSWORD
|