16.4 字典对象缓存
The dictionary object cache is a shared global cache that stores previously accessed data dictionary objects in memory to enable object reuse and minimize disk I/O. Similar to other cache mechanisms used by MySQL, the dictionary object cache uses an LRU-based eviction strategy to evict least recently used objects from memory.
The dictionary object cache comprises cache partitions that store different object types. Some cache partition size limits are configurable, whereas others are hardcoded.
-
tablespace definition cache partition: Stores tablespace definition objects. The
tablespace_definition_cache
option sets a limit for the number of tablespace definition objects that can be stored in the dictionary object cache. The default value is 256. -
schema definition cache partition: Stores schema definition objects. The
schema_definition_cache
option sets a limit for the number of schema definition objects that can be stored in the dictionary object cache. The default value is 256. -
table definition cache partition: Stores table definition objects. The object limit is set to the value of
max_connections
, which has a default value of 151.The table definition cache partition exists in parallel with the table definition cache that is configured using the
table_definition_cache
configuration option. Both caches store table definitions but serve different parts of the MySQL server. Objects in one cache have no dependence on the existence of objects in the other. -
stored program definition cache partition: Stores stored program definition objects. The
stored_program_definition_cache
option sets a limit for the number of stored program definition objects that can be stored in the dictionary object cache. The default value is 256.The stored program definition cache partition exists in parallel with the stored procedure and stored function caches that are configured using the
stored_program_cache
option.The
stored_program_cache
option sets a soft upper limit for the number of cached stored procedures or functions per connection, and the limit is checked each time a connection executes a stored procedure or function. The stored program definition cache partition, on the other hand, is a shared cache that stores stored program definition objects for other purposes. The existence of objects in the stored program definition cache partition has no dependence on the existence of objects in the stored procedure cache or stored function cache, and vice versa. -
character set definition cache partition: Stores character set definition objects and has a hardcoded object limit of 256.
-
collation definition cache partition: Stores collation definition objects and has a hardcoded object limit of 256.
For information about valid values for dictionary object cache configuration options, refer to Section 7.1.8, “Server System Variables”.