Limiting cache memory use

The initial, minimum, and maximum cache sizes are all controllable from the database server command line.

  • Initial cache size   You can change the initial cache size by specifying the database server -c option. The default value is as follows:

    • Windows Mobile   The formula is as follows:
      max( 600 KB, min( dbsize, physical-memory ) );

      The dbsize is the total size of the database file or files started, and physical-memory is 25% of the physical memory on the computer.

    • Windows   The formula is as follows:
      max( 2 MB, min( dbsize, physical-memory ) );

      The dbsize is the total size of the database file or files started, and physical-memory is 25% of the physical memory on the computer.

      If an AWE cache is used on Windows the formula is as follows:

      min( 100% of available memory-128MB, dbsize );

      An AWE cache is not used if this value is smaller than 2 MB.

      For information about AWE caches, see -cw server option.

    • Unix   At least 8 MB.

      For information about Unix initial cache size, see Dynamic cache sizing on Unix.

  • Maximum cache size   You can control the maximum cache size by specifying the database server -ch option. The default is based on a heuristic that depends on the physical memory in your computer. On Windows Mobile, the default maximum cache size is the amount of available program memory minus 4 MB. On other non-Unix computers, this is approximately the lower of the maximum non-AWE cache size and 90% of the physical memory of the computer. On Unix, the default maximum cache size is calculated as follows:

    • On 32-bit Unix platforms, it is the lesser of 90% of total physical memory or 1,834,880 KB.

    • On 64-bit Unix platforms, it is the lesser of 90% of total physical memory and 8,589,672,320 KB.

  • Minimum cache size   You can control the minimum cache size by specifying the database server -cl server option. By default, the minimum cache size is the same as the initial cache size, except on Windows Mobile. On Windows Mobile, the default minimum cache size is 600 KB.

You can also disable dynamic cache sizing by using the -ca 0 server option.

The following server properties return information about the database server cache:

  • MinCacheSize   Returns the minimum allowed cache size, in kilobytes.

  • MaxCacheSize   Returns the maximum allowed cache size, in kilobytes.

  • CurrentCacheSize   Returns the current cache size, in kilobytes.

  • PeakCacheSize   Returns the largest value the cache has reached in the current session, in kilobytes.

For information about obtaining server property values, see Database server properties.

See also