PreviousSQL Engine Reference (v9 SP2 (9.5) revision 1) Next

SET PROCEDURES_CACHE

Chapter contents

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.

Syntax

SET PROCEDURES_CACHE = megabytes 

Remarks

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.

Registry Setting

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:

  1. Locate the following key:
  2. HKEY_LOCAL_MACHINE\SOFTWARE\Pervasive Software\SQL 
    Relational Engine 
     
    

    Note
    In most Windows operating systems, the `Pervasive Software' key is HKEY_LOCAL_MACHINE\SOFTWARE\PERVASIVE SOFTWARE. However, its location under HKEY_LOCAL_MACHINE\SOFTWARE can vary depending on the operating system.
  3. For this key, create a new string valued named ProceduresCache.
  4. Set ProceduresCache to the desired amount of memory that you want to cache.

To specify the amount of cache memory in the Pervasive Registry (Linux or NetWare):

  1. Locate the following key:
  2. PS_HKEY_CONFIG\SOFTWARE\Pervasive Software\SQL 
    Relational Engine 
    
  3. For this key, create a new string valued named ProceduresCache.
  4. Set ProceduresCache to the desired amount of memory that you want to cache.

Caching Exclusions

A stored procedure is not cached, regardless of the cache setting(s), for any of the following:

Examples

The following example sets a cache memory of 2 MB that stores up to 20 stored procedures.

SET CACHED_PROCEDURES = 20 
SET PROCEDURES_CACHE = 2 


The following example sets a cache memory of 1,000 MB that stores up to 500 stored procedures.

SET CACHED_PROCEDURES = 500 
SET PROCEDURES_CACHE = 1000 


The following example specifies that you do not want to cache stored procedures and that any existing procedures cache will be removed.

SET CACHED_PROCEDURES = 0 
SET PROCEDURES_CACHE = 0 


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.

SET PROCEDURES_CACHE = 80 

(The database engine implicitly sets CACHED_PROCEDURES to zero.)

See Also

CREATE PROCEDURE

SET CACHED_PROCEDURES


Chapter contents
Book contents

Prev topic: SET PASSWORD
Next topic: SET ROWCOUNT