MariaDB supports all needed data dictionary queries trough
information schema. However in the case of a lot of tables, some
queries can be slow as MariaDB has to open the .frm file for each
table, which takes time if there are 10000+ tables.
Adding a data dictionary cache will solve this performance problem.
It will also make 'open table' slightly faster and will potentially
allow MariaDB to work with a smaller table definition cache.
While adding data dictionary cache, we still want to support the the
current behaviour of 'just copy and use' tables that some of our users
- One can copy a closed MyISAM, CVS or Aria table from one database or
server instance to another and use it without any need for export or import.
There is a plan to also support this for InnoDB in the future.
- One can do this on a live server by flushing the table, or directly from/to
a fully shutdown server
- This also simplifies restoring a table from a backup as no import is needed.
To support this, the data dictionary cash should work as follows:
- The data dictionary is a table in the mysql database.
- The 'data dictionary' is regarded as the master. "open table" will first
look at the cache for the table definition.
- When opening the table, we will check that the table id in the storage engine
matches the table id in the the cache. If not, we will disregard the cached
entry and instead read the .frm and create a new entry in the cache and
- If the table is not found in the cache during open, we will try to first
use the .frm and if not found then do a discovery. If table is found it
will be added to the cache.
From the above follows that one can truncate the cache table any time
and it will be automatically generated. This feature can be used with
mysql_upgrade if we at some point decide to change format in cache
The data dictionary table will contain at least the following fields:
- database name
- table name
- Storage engine
- table id
- .frm information (possible in dynamic column format for quick and portable