8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

正文为中文,英文原文默认隐藏。点击任意中文段落即可展开 / 收起对应英文原文。

打开官方英文原文 ↗

译文由机器翻译生成,仅供理解参考;有疑问请以官方英文原文为准。

MySQL 8.4 参考手册 / 16 MySQL 数据字典 / 16.6 序列化字典信息(SDI)
中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

16.6 序列化字典信息 (SDI)16.6 Serialized Dictionary Information (SDI)

除了在数据字典中存储关于数据库对象的元数据外,MySQL 还以序列化形式存储这些数据。这些数据称为序列化字典信息 (SDI)。InnoDB 将 SDI 数据存储在其表空间文件中。NDBCLUSTER 将 SDI 数据存储在 NDB 字典中。其他存储引擎将 SDI 数据存储在为某个表在其数据库目录中创建的 .sdi 文件中。SDI 数据以紧凑的 JSON 格式生成。In addition to storing metadata about database objects in the data dictionary, MySQL stores it in serialized form. This data is referred to as serialized dictionary information (SDI). InnoDB stores SDI data within its tablespace files. NDBCLUSTER stores SDI data in the NDB dictionary. Other storage engines store SDI data in .sdi files that are created for a given table in the table's database directory. SDI data is generated in a compact JSON format.

序列化字典信息 (SDI) 存在于所有 InnoDB 表空间文件中,临时表空间和撤销表空间文件除外。InnoDB 表空间文件中的 SDI 记录仅描述表空间内的表和表空间对象。Serialized dictionary information (SDI) is present in all InnoDB tablespace files except for temporary tablespace and undo tablespace files. SDI records in an InnoDB tablespace file only describe table and tablespace objects contained within the tablespace.

SDI 数据会在对表执行 DDL 操作或 CHECK TABLE FOR UPGRADE 时更新。MySQL 服务器升级到新版本时,SDI 数据不会更新。SDI data is updated by DDL operations on a table or CHECK TABLE FOR UPGRADE. SDI data is not updated when the MySQL server is upgraded to a new release or version.

SDI 数据的存在提供了元数据冗余。例如,如果数据字典不可用,可以使用 ibd2sdi 工具直接从 InnoDB 表空间文件中提取对象元数据。The presence of SDI data provides metadata redundancy. For example, if the data dictionary becomes unavailable, object metadata can be extracted directly from InnoDB tablespace files using the ibd2sdi tool.

对于 InnoDB,SDI 记录只需要一个索引页,默认大小为 16KB。然而,SDI 数据会被压缩以减少存储空间占用。For InnoDB, an SDI record requires a single index page, which is 16KB in size by default. However, SDI data is compressed to reduce the storage footprint.

对于由多个表空间组成的分区 InnoDB 表,SDI 数据存储在第一个分区的表空间文件中。For partitioned InnoDB tables comprised of multiple tablespaces, SDI data is stored in the tablespace file of the first partition.

MySQL 服务器使用一个内部 API,在 DDL 操作期间访问该 API,以创建和维护 SDI 记录。The MySQL server uses an internal API that is accessed during DDL operations to create and maintain SDI records.

IMPORT TABLE 语句根据 .sdi 文件中包含的信息导入 MyISAM 表。更多信息请参见 第 15.2.6 节,“IMPORT TABLE 语句”。The IMPORT TABLE statement imports MyISAM tables based on information contained in .sdi files. For more information, see Section 15.2.6, “IMPORT TABLE Statement”.