14.16.7 InnoDB INFORMATION_SCHEMA Temporary Table Info Table
INNODB_TEMP_TABLE_INFO provides information about user-created InnoDB temporary tables that are active in the InnoDB instance. It does not provide information about internal InnoDB temporary tables used by the optimizer.
mysql> SHOW TABLES FROM INFORMATION_SCHEMA LIKE 'INNODB_TEMP%';
+---------------------------------------------+
| Tables_in_INFORMATION_SCHEMA (INNODB_TEMP%) |
+---------------------------------------------+
| INNODB_TEMP_TABLE_INFO |
+---------------------------------------------+
For the table definition, see Section 24.4.27, “The INFORMATION_SCHEMA INNODB_TEMP_TABLE_INFO Table”.
Example 14.12 INNODB_TEMP_TABLE_INFO
This example demonstrates characteristics of the INNODB_TEMP_TABLE_INFO table.
-
Create a simple
InnoDBtemporary table:mysql>
CREATE TEMPORARY TABLE t1 (c1 INT PRIMARY KEY) ENGINE=INNODB; -
Query
INNODB_TEMP_TABLE_INFOto view the temporary table metadata.mysql>
SELECT * FROM INFORMATION_SCHEMA.INNODB_TEMP_TABLE_INFO\G*************************** 1. row *************************** TABLE_ID: 194 NAME: #sql7a79_1_0 N_COLS: 4 SPACE: 182 PER_TABLE_TABLESPACE: FALSE IS_COMPRESSED: FALSEThe
TABLE_IDis a unique identifier for the temporary table. TheNAMEcolumn displays the system-generated name for the temporary table, which is prefixed with “#sql”. The number of columns (N_COLS) is 4 rather than 1 becauseInnoDBalways creates three hidden table columns (DB_ROW_ID,DB_TRX_ID, andDB_ROLL_PTR).PER_TABLE_TABLESPACEandIS_COMPRESSEDreportTRUEfor compressed temporary tables. Otherwise, these fields reportFALSE. -
Create a compressed temporary table.
mysql>
CREATE TEMPORARY TABLE t2 (c1 INT) ROW_FORMAT=COMPRESSED ENGINE=INNODB; -
Query
INNODB_TEMP_TABLE_INFOagain.mysql>
SELECT * FROM INFORMATION_SCHEMA.INNODB_TEMP_TABLE_INFO\G*************************** 1. row *************************** TABLE_ID: 195 NAME: #sql7a79_1_1 N_COLS: 4 SPACE: 183 PER_TABLE_TABLESPACE: TRUE IS_COMPRESSED: TRUE *************************** 2. row *************************** TABLE_ID: 194 NAME: #sql7a79_1_0 N_COLS: 4 SPACE: 182 PER_TABLE_TABLESPACE: FALSE IS_COMPRESSED: FALSEPER_TABLE_TABLESPACEandIS_COMPRESSEDreportTRUEfor the compressed temporary table. TheSPACEID for the compressed temporary table is different because compressed temporary tables are created in separate file-per-table tablespaces. Non-compressed temporary tables are created in the shared temporary tablespace (ibtmp1) and report the sameSPACEID. -
Restart MySQL and query
INNODB_TEMP_TABLE_INFO.mysql>
SELECT * FROM INFORMATION_SCHEMA.INNODB_TEMP_TABLE_INFO\GEmpty set (0.00 sec)An empty set is returned because
INNODB_TEMP_TABLE_INFOand its data are not persisted to disk when the server is shut down. -
Create a new temporary table.
mysql>
CREATE TEMPORARY TABLE t1 (c1 INT PRIMARY KEY) ENGINE=INNODB; -
Query
INNODB_TEMP_TABLE_INFOto view the temporary table metadata.mysql>
SELECT * FROM INFORMATION_SCHEMA.INNODB_TEMP_TABLE_INFO\G*************************** 1. row *************************** TABLE_ID: 196 NAME: #sql7b0e_1_0 N_COLS: 4 SPACE: 184 PER_TABLE_TABLESPACE: FALSE IS_COMPRESSED: FALSEThe
SPACEID may be different because it is dynamically generated when the server is started.
© 2025 Oracle
Licensed under the GPLv2 License.