Unifying query caches

To enable the unified query caches, set the option server.memory.query_cache.sharing_enabled=true.

Table 1. Unified 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

When this feature is enabled, all databases use only one set of query caches. A database may store and retrieve entries from the shared cache, but it may not retrieve entries produced by another database.

While databases use the same set of caches, a database may not observe entries originating from other databases.

The database may, however, evict entries from other databases as necessary, according to the constrained cache size and cache eviction policy. In essence, databases may compete for cache space, but may not observe each other’s entries.

When this option is turned on, the cache space available to all databases is configured using the setting server.memory.query_cache.shared_cache_num_entries.