INNODB_TABLESPACES 表提供关于 InnoDB 文件每表、通用和撤销表空间的元数据。The INNODB_TABLESPACES table provides
metadata about InnoDB file-per-table, general,
and undo tablespaces.
有关相关的使用信息和示例,请参见 第 17.15.3 节,“InnoDB INFORMATION_SCHEMA 模式对象表”。For related usage information and examples, see Section 17.15.3, “InnoDB INFORMATION_SCHEMA Schema Object Tables”.
INFORMATION_SCHEMA FILES 表报告了 InnoDB 表空间类型的元数据,包括每表文件表空间、通用表空间、系统表空间、全局临时表空间和回滚表空间。The INFORMATION_SCHEMA
FILES table reports metadata for
InnoDB tablespace types including
file-per-table tablespaces, general tablespaces, the system
tablespace, the global temporary tablespace, and undo
tablespaces.
INNODB_TABLESPACES 表具有以下列:The INNODB_TABLESPACES table has
these columns:
SPACE表空间 ID。The tablespace ID.
NAMENAME模式(数据库)和表名。The schema (database) and table name.
FLAG表示表空间格式和存储特性的位级信息的数值。A numeric value that represents bit-level information about tablespace format and storage characteristics.
ROW_FORMATROW_FORMAT表空间行格式(
Compact or Redundant,Dynamic或Compressed,或者Undo)。此列中的数据是根据存储在数据文件中的表空间标志信息解释得出的。The tablespace row format (Compact or Redundant,DynamicorCompressed, orUndo). The data in this column is interpreted from the tablespace flag information that resides in the data file.无法通过这些标志信息判断表空间行格式是
Redundant还是Compact,这就是为什么其中一个可能的ROW_FORMAT值是Compact or Redundant。There is no way to determine from this flag information if the tablespace row format isRedundantorCompact, which is why one of the possibleROW_FORMATvalues isCompact or Redundant.PAGE_SIZE表空间页大小。此列中的数据是根据存储在
.ibd文件 中的表空间标志信息解释得出的。The tablespace page size. The data in this column is interpreted from the tablespace flags information that resides in the.ibdfile.ZIP_PAGE_SIZE表空间压缩页的大小。此列中的数据是根据存储在
.ibd文件中的表空间标志信息进行解释的。The tablespace zip page size. The data in this column is interpreted from the tablespace flags information that resides in the.ibdfile.SPACE_TYPE表空间的类型。可能的值包括用于通用表空间的
General,用于每表单文件表空间的Single,系统表空间的System,以及撤销表空间的Undo。The type of tablespace. Possible values includeGeneralfor general tablespaces,Singlefor file-per-table tablespaces,Systemfor the system tablespace, andUndofor undo tablespaces.FS_BLOCK_SIZE文件系统块大小,即用于打孔的单位大小。此列与
InnoDB透明页压缩功能相关。The file system block size, which is the unit size used for hole punching. This column pertains to theInnoDBtransparent page compression feature.FILE_SIZE文件的表观大小,表示文件的最大未压缩大小。此列与
InnoDB透明页压缩 功能相关。The apparent size of the file, which represents the maximum size of the file, uncompressed. This column pertains to theInnoDBtransparent page compression feature.ALLOCATED_SIZE文件的实际大小,即磁盘上分配的空间量。此列与
InnoDB透明页压缩 功能相关。The actual size of the file, which is the amount of space allocated on disk. This column pertains to theInnoDBtransparent page compression feature.AUTOEXTEND_SIZE表空间的自动扩展大小。The auto-extend size of the tablespace.
SERVER_VERSIONThe MySQL version that created the tablespace, or the MySQL version into which the tablespace was imported, or the version of the last major MySQL version upgrade. The value is unchanged by a release series upgrade, such as an upgrade from MySQL 8.4.
xto 8.4.y. The value can be considered a “creation” marker or “certified” marker for the tablespace.SPACE_VERSION表空间版本,用于跟踪表空间格式的更改。The tablespace version, used to track changes to the tablespace format.
ENCRYPTIONENCRYPTION表空间是否加密。Whether the tablespace is encrypted.
STATE表空间状态。The tablespace state.
对于每表文件和通用表空间,状态包括:For file-per-table and general tablespaces, states include:
normal:表空间正常且激活。normal: The tablespace is normal and active.discarded:表空间已被ALTER TABLE ... DISCARD TABLESPACE语句丢弃。discarded: The tablespace was discarded by anALTER TABLE ... DISCARD TABLESPACEstatement.corrupted:该表空间已被InnoDB识别为损坏。corrupted: The tablespace is identified byInnoDBas corrupted.
对于撤销表空间,状态包括:For undo tablespaces, states include:
active:撤销表空间中的回滚段可以被分配给新的事务。active: Rollback segments in the undo tablespace can be allocated to new transactions.inactive:撤销表空间中的回滚段不再被新事务使用。截断过程正在进行中。撤销表空间要么是被清除线程自动选择的,要么是通过ALTER UNDO TABLESPACE ... SET INACTIVE语句设为非活动状态的。inactive: Rollback segments in the undo tablespace are no longer used by new transactions. The truncate process is in progress. The undo tablespace was either selected by the purge thread implicitly or was made inactive by anALTER UNDO TABLESPACE ... SET INACTIVEstatement.empty:撤销表空间已被截断,不再处于活动状态。它已经准备好被删除,或者可以通过ALTER UNDO TABLESPACE ... SET INACTIVE语句重新激活。empty: The undo tablespace was truncated and is no longer active. It is ready to be dropped or made active again by anALTER UNDO TABLESPACE ... SET INACTIVEstatement.
示例Example
mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE SPACE = 26\G
*************************** 1. row ***************************
SPACE: 26
NAME: test/t1
FLAG: 0
ROW_FORMAT: Compact or Redundant
PAGE_SIZE: 16384
ZIP_PAGE_SIZE: 0
SPACE_TYPE: Single
FS_BLOCK_SIZE: 4096
FILE_SIZE: 98304
ALLOCATED_SIZE: 65536
AUTOEXTEND_SIZE: 0
SERVER_VERSION: 8.4.0
SPACE_VERSION: 1
ENCRYPTION: N
STATE: normal
注释Notes
你必须拥有
PROCESS权限才能查询此表。You must have thePROCESSprivilege to query this table.使用
INFORMATION_SCHEMACOLUMNS表或SHOW COLUMNS语句查看关于此表列的更多信息,包括数据类型和默认值。Use theINFORMATION_SCHEMACOLUMNStable or theSHOW COLUMNSstatement to view additional information about the columns of this table, including data types and default values.