Configuring the In-Memory Cache
Prev | Chapter 3. Configuring the Berkeley DB SQL interface | Next

## Configuring the In-Memory Cache

SQLite provides an in-memory cache which you size according to the maximum number of database pages that you want to hold in memory at any given time.

Berkeley DB also provides an in-memory cache that performs the same function as SQLite. You can configure this cache using the exact same PRAGMAs as you are used to using with SQLite. See PRAGMA cache_size and PRAGMA default_cache_size for details. As is the case with SQLite, you use these PRAGMAs to describe the total number of pages that you want in the cache.

Note that you can change the cache size only if no table operations have been executed on the database. In other words, to change your cache size:

- Open a handle to your database.

- Execute `PRAGMA cache_size`

- Proceed with any table modification operations (`CREATE`, `UPDATE`, `INSERT`, `SELECT`) that you might want to perform.

Alternatively, you can set you cache size with your `DB_CONFIG` file, and so skip the necessity of executing the PRAGMA. See the Berkeley DB C API for details.

Prev | Up | Next
Selecting the Database File Size | Home | Administering Log Files