I'm experiencing unexpected behavior in trying to use the `-pagecache`
option for the `sqlite3` shell. Specifically, the `-pagecache` option
appears to have no effect even though `pragma cache_size` does. I can
see in the code that `-pagecache` causes an allocation which is stored
in the global configuration, so at this point I'm not sure what is
happening or what to do next.
The PRAGMA cache_size=N sets a soft upper bound on the number of cache
buffers that will be used. The -pagecache option uses
sqlite3_config(SQLITE_CONFIG_PAGECACHE) to use a separate memory
allocation as the initial memory pull from which to draw cache
buffers. These are different things, and so one does not necessarily
change the other.
The PRAGMA cache_size=N is used to limit memory usage.
The SQLITE_CONFIG_PAGECACHE option is designed to reduce memory
https://www.sqlite.org/malloc.html#_page_cache_memory for further
information on what that means and why it is important for some
systems. (Hint: Unless you are working on a safety-critical embedded
system, this probably is not important to you.)