The INNODB_TABLESPACES table provides
metadata about InnoDB file-per-table, general,
and undo tablespaces.
For related usage information and examples, see Section 17.15.3, “InnoDB INFORMATION_SCHEMA Schema Object Tables”.
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.
The INNODB_TABLESPACES table has
these columns:
SPACEThe tablespace ID.
NAMEThe schema (database) and table name.
FLAGA numeric value that represents bit-level information about tablespace format and storage characteristics.
ROW_FORMATThe 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.There is no way to determine from this flag information if the tablespace row format is
RedundantorCompact, which is why one of the possibleROW_FORMATvalues isCompact or Redundant.PAGE_SIZEThe tablespace page size. The data in this column is interpreted from the tablespace flags information that resides in the
.ibdfile.ZIP_PAGE_SIZEThe tablespace zip page size. The data in this column is interpreted from the tablespace flags information that resides in the
.ibdfile.SPACE_TYPEThe type of tablespace. Possible values include
Generalfor general tablespaces,Singlefor file-per-table tablespaces,Systemfor the system tablespace, andUndofor undo tablespaces.FS_BLOCK_SIZEThe file system block size, which is the unit size used for hole punching. This column pertains to the
InnoDBtransparent page compression feature.FILE_SIZEThe apparent size of the file, which represents the maximum size of the file, uncompressed. This column pertains to the
InnoDBtransparent page compression feature.ALLOCATED_SIZEThe actual size of the file, which is the amount of space allocated on disk. This column pertains to the
InnoDBtransparent page compression feature.AUTOEXTEND_SIZEThe 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_VERSIONThe tablespace version, used to track changes to the tablespace format.
ENCRYPTIONWhether the tablespace is encrypted.
STATEThe tablespace state.
For file-per-table and general tablespaces, states include:
normal: The tablespace is normal and active.discarded: The tablespace was discarded by anALTER TABLE ... DISCARD TABLESPACEstatement.corrupted: The tablespace is identified byInnoDBas corrupted.
For undo tablespaces, states include:
active: Rollback segments in the undo tablespace can be allocated to new transactions.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: 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
You must have the
PROCESSprivilege to query this table.Use the
INFORMATION_SCHEMACOLUMNStable or theSHOW COLUMNSstatement to view additional information about the columns of this table, including data types and default values.