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:

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.