Search code examples
sqlitecachingshared-cache

How to configure size of shared-cache in SQLite?


SQLite provide a shared-cache mode (https://www.sqlite.org/sharedcache.html) which will help to reduce cache size among multiple connections within a process. But how to configure the size of the shared cache? I've tried PRAGMA cache_size = 536870912. But no matter how much space i offered, it seems to have no effect on memory consumption. So is there's a configuration to set the size of shared-cache?


Solution

  • There is not special shared cache; the shared-cache mode just shared the normal cache. This cache can be configured with PRAGMA cache_size.

    With the default page size of 4 KB, a cache size of 536870912 pages would result in a limit of 2 TB. It is unlikely that you have reached that.