Query caches

Out of the box, the set of query caches is per database. That means that a new set of caches is initialized for each new database.

The maximum number of entries per cache is configured using server.memory.query_cache.per_db_cache_num_entries. It determines the cache size only when server.memory.query_cache.sharing_enabled is set to false.

Query caches may consume a lot of memory, especially when running many active databases. To tackle this and improve predictability on memory consumption, you can configure the DBMS to use only one set of caches for all databases. For more information, see Unifying query caches.

Configure caches

The following is a summary of the query cache configurations. For more information, see Operations Manual → Configuration settings.

Table 1. Query cache configurations
Setting Description Default

server.memory.query_cache.sharing_enabled

Enterprise only Enable sharing cache space between different databases. With this option turned on, databases will share cache space, but not cache entries.

false

server.memory.query_cache.shared_cache_num_entries

Enterprise only The number of cached queries for all databases. This setting is only deciding cache size when server.memory.query_cache.sharing_enabled is set to true.

1000

server.memory.query_cache.per_db_cache_num_entries

The number of cached queries per database. This setting is only deciding cache size when server.memory.query_cache.sharing_enabled is set to false.

1000