These VARIABLES may be relevant:
table_open_cache
table_open_cache_instances
table_definition_cache
schema_definition_cache (new in 8.0)
tablespace_definition_cache (new in 8.0)
Each cache is a fixed size, configurable at startup time. (In some cases, on newer versions, it can be dynamically changed.) The docs for 5.7 say, for example, that table_open_cache
is "Dynamic"
These GLOBAL STATUS values may be relevant:
Open_table_definitions
Opened_table_definitions
Opened_tables
Opened_files
Table_open_cache_hits
Table_open_cache_misses
Table_open_cache_overflows
The hits/misses/overflows give you good clues as to whether the table_open_cache
is big enough, but not what the optimal size is.
In 5.7 and before, the data dictionary comes from the .frm
files scattered on disk. In 8.0, it is in a set of InnoDB tables. Presumably, a suitable query could provide some relevant metrics.
See also things like performance_schema_max_table_handles.