[MDEV-17581] Data dictionary Created: 2018-10-31  Updated: 2024-01-18

Status: Open
Project: MariaDB Server
Component/s: Data Definition - Create Table
Fix Version/s: None

Type: New Feature Priority: Major
Reporter: Michael Widenius Assignee: Unassigned
Resolution: Unresolved Votes: 2
Labels: None

Issue Links:
Blocks
is blocked by MDEV-18518 Implement atomic multi-table (or mult... Closed
PartOf
is part of MDEV-11655 Transactional data dictionary Open
Relates
relates to MDEV-28979 Feature Request: Allow for indexes to... Closed

 Description   

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
depending upon:

  • 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
    retry.
  • 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
table.

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
    access)


 Comments   
Comment by Marko Mäkelä [ 2018-10-31 ]

If there is only one table ID, then InnoDB may have to change its undo log format for partitioned tables, so that all partitions or subpartitions of a table would use a single table_id. That could be a good idea in any case.

Comment by Alexander Barkov [ 2018-11-07 ]

Monty, please put the full CREATE TABLE definition for the data dictionary table (with column sizes, character sets and collations, and the rest).

Generated at Thu Feb 08 08:37:33 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.