Chapter 24 INFORMATION_SCHEMA Tables

Table of Contents

24.1 The INFORMATION_SCHEMA CHARACTER_SETS Table
24.2 The INFORMATION_SCHEMA COLLATIONS Table
24.3 The INFORMATION_SCHEMA COLLATION_CHARACTER_SET_APPLICABILITY Table
24.4 The INFORMATION_SCHEMA COLUMNS Table
24.5 The INFORMATION_SCHEMA COLUMN_PRIVILEGES Table
24.6 The INFORMATION_SCHEMA COLUMN_STATISTICS Table
24.7 The INFORMATION_SCHEMA ENGINES Table
24.8 The INFORMATION_SCHEMA EVENTS Table
24.9 The INFORMATION_SCHEMA FILES Table
24.10 The INFORMATION_SCHEMA KEY_COLUMN_USAGE Table
24.11 The INFORMATION_SCHEMA KEYWORDS Table
24.12 The INFORMATION_SCHEMA OPTIMIZER_TRACE Table
24.13 The INFORMATION_SCHEMA PARAMETERS Table
24.14 The INFORMATION_SCHEMA PARTITIONS Table
24.15 The INFORMATION_SCHEMA PLUGINS Table
24.16 The INFORMATION_SCHEMA PROCESSLIST Table
24.17 The INFORMATION_SCHEMA PROFILING Table
24.18 The INFORMATION_SCHEMA REFERENTIAL_CONSTRAINTS Table
24.19 The INFORMATION_SCHEMA RESOURCE_GROUPS Table
24.20 The INFORMATION_SCHEMA ROUTINES Table
24.21 The INFORMATION_SCHEMA SCHEMATA Table
24.22 The INFORMATION_SCHEMA SCHEMA_PRIVILEGES Table
24.23 The INFORMATION_SCHEMA STATISTICS Table
24.24 The INFORMATION_SCHEMA ST_GEOMETRY_COLUMNS Table
24.25 The INFORMATION_SCHEMA ST_SPATIAL_REFERENCE_SYSTEMS Table
24.26 The INFORMATION_SCHEMA TABLES Table
24.27 The INFORMATION_SCHEMA TABLESPACES Table
24.28 The INFORMATION_SCHEMA TABLE_CONSTRAINTS Table
24.29 The INFORMATION_SCHEMA TABLE_PRIVILEGES Table
24.30 The INFORMATION_SCHEMA TRIGGERS Table
24.31 The INFORMATION_SCHEMA USER_PRIVILEGES Table
24.32 The INFORMATION_SCHEMA VIEWS Table
24.33 InnoDB INFORMATION_SCHEMA Tables
24.33.1 The INFORMATION_SCHEMA INNODB_BUFFER_PAGE Table
24.33.2 The INFORMATION_SCHEMA INNODB_BUFFER_PAGE_LRU Table
24.33.3 The INFORMATION_SCHEMA INNODB_BUFFER_POOL_STATS Table
24.33.4 The INFORMATION_SCHEMA INNODB_CACHED_INDEXES Table
24.33.5 The INFORMATION_SCHEMA INNODB_CMP and INNODB_CMP_RESET Tables
24.33.6 The INFORMATION_SCHEMA INNODB_CMPMEM and INNODB_CMPMEM_RESET Tables
24.33.7 The INFORMATION_SCHEMA INNODB_CMP_PER_INDEX and INNODB_CMP_PER_INDEX_RESET Tables
24.33.8 The INFORMATION_SCHEMA INNODB_FT_BEING_DELETED Table
24.33.9 The INFORMATION_SCHEMA INNODB_FT_CONFIG Table
24.33.10 The INFORMATION_SCHEMA INNODB_FT_DEFAULT_STOPWORD Table
24.33.11 The INFORMATION_SCHEMA INNODB_FT_DELETED Table
24.33.12 The INFORMATION_SCHEMA INNODB_FT_INDEX_CACHE Table
24.33.13 The INFORMATION_SCHEMA INNODB_FT_INDEX_TABLE Table
24.33.14 The INFORMATION_SCHEMA INNODB_LOCKS Table
24.33.15 The INFORMATION_SCHEMA INNODB_LOCK_WAITS Table
24.33.16 The INFORMATION_SCHEMA INNODB_METRICS Table
24.33.17 The INFORMATION_SCHEMA INNODB_COLUMNS Table
24.33.18 The INFORMATION_SCHEMA INNODB_DATAFILES Table
24.33.19 The INFORMATION_SCHEMA INNODB_FIELDS Table
24.33.20 The INFORMATION_SCHEMA INNODB_FOREIGN Table
24.33.21 The INFORMATION_SCHEMA INNODB_FOREIGN_COLS Table
24.33.22 The INFORMATION_SCHEMA INNODB_INDEXES Table
24.33.23 The INFORMATION_SCHEMA INNODB_TABLES Table
24.33.24 The INFORMATION_SCHEMA INNODB_TABLESPACES Table
24.33.25 The INFORMATION_SCHEMA INNODB_TABLESPACES_BRIEF Table
24.33.26 The INFORMATION_SCHEMA INNODB_TABLESTATS View
24.33.27 The INFORMATION_SCHEMA INNODB_VIRTUAL Table
24.33.28 The INFORMATION_SCHEMA INNODB_TEMP_TABLE_INFO Table
24.33.29 The INFORMATION_SCHEMA INNODB_TRX Table
24.34 Thread Pool INFORMATION_SCHEMA Tables
24.34.1 The INFORMATION_SCHEMA TP_THREAD_GROUP_STATE Table
24.34.2 The INFORMATION_SCHEMA TP_THREAD_GROUP_STATS Table
24.34.3 The INFORMATION_SCHEMA TP_THREAD_STATE Table
24.35 Connection-Control INFORMATION_SCHEMA Tables
24.35.1 The INFORMATION_SCHEMA CONNECTION_CONTROL_FAILED_LOGIN_ATTEMPTS Table
24.36 Extensions to SHOW Statements

INFORMATION_SCHEMA provides access to database metadata, information about the MySQL server such as the name of a database or table, the data type of a column, or access privileges. Other terms that are sometimes used for this information are data dictionary and system catalog.

INFORMATION_SCHEMA Usage Notes

INFORMATION_SCHEMA is a database within each MySQL instance, the place that stores information about all the other databases that the MySQL server maintains. The INFORMATION_SCHEMA database contains several read-only tables. They are actually views, not base tables, so there are no files associated with them, and you cannot set triggers on them. Also, there is no database directory with that name.

Although you can select INFORMATION_SCHEMA as the default database with a USE statement, you can only read the contents of tables, not perform INSERT, UPDATE, or DELETE operations on them.

Example

Here is an example of a statement that retrieves information from INFORMATION_SCHEMA:

mysql> SELECT table_name, table_type, engine
       FROM information_schema.tables
       WHERE table_schema = 'db5'
       ORDER BY table_name;
+------------+------------+--------+
| table_name | table_type | engine |
+------------+------------+--------+
| fk         | BASE TABLE | InnoDB |
| fk2        | BASE TABLE | InnoDB |
| goto       | BASE TABLE | MyISAM |
| into       | BASE TABLE | MyISAM |
| k          | BASE TABLE | MyISAM |
| kurs       | BASE TABLE | MyISAM |
| loop       | BASE TABLE | MyISAM |
| pk         | BASE TABLE | InnoDB |
| t          | BASE TABLE | MyISAM |
| t2         | BASE TABLE | MyISAM |
| t3         | BASE TABLE | MyISAM |
| t7         | BASE TABLE | MyISAM |
| tables     | BASE TABLE | MyISAM |
| v          | VIEW       | NULL   |
| v2         | VIEW       | NULL   |
| v3         | VIEW       | NULL   |
| v56        | VIEW       | NULL   |
+------------+------------+--------+
17 rows in set (0.01 sec)

Explanation: The statement requests a list of all the tables in database db5, showing just three pieces of information: the name of the table, its type, and its storage engine.

Character Set Considerations

The definition for character columns (for example, TABLES.TABLE_NAME) is generally VARCHAR(N) CHARACTER SET utf8 where N is at least 64. MySQL uses the default collation for this character set (utf8_general_ci) for all searches, sorts, comparisons, and other string operations on such columns.

Because some MySQL objects are represented as files, searches in INFORMATION_SCHEMA string columns can be affected by file system case sensitivity. For more information, see Section 10.8.7, “Using Collation in INFORMATION_SCHEMA Searches”.

INFORMATION_SCHEMA as Alternative to SHOW Statements

The SELECT ... FROM INFORMATION_SCHEMA statement is intended as a more consistent way to provide access to the information provided by the various SHOW statements that MySQL supports (SHOW DATABASES, SHOW TABLES, and so forth). Using SELECT has these advantages, compared to SHOW:

Because SHOW is familiar and widely used, the SHOW statements remain as an alternative. In fact, along with the implementation of INFORMATION_SCHEMA, there are enhancements to SHOW as described in Section 24.36, “Extensions to SHOW Statements”.

Privileges

Each MySQL user has the right to access these tables, but can see only the rows in the tables that correspond to objects for which the user has the proper access privileges. In some cases (for example, the ROUTINE_DEFINITION column in the INFORMATION_SCHEMA.ROUTINES table), users who have insufficient privileges see NULL. These restrictions do not apply for InnoDB tables; you can see them with only the PROCESS privilege.

The same privileges apply to selecting information from INFORMATION_SCHEMA and viewing the same information through SHOW statements. In either case, you must have some privilege on an object to see information about it.

Performance Considerations

INFORMATION_SCHEMA queries that search for information from more than one database might take a long time and impact performance. To check the efficiency of a query, you can use EXPLAIN. For information about using EXPLAIN output to tune INFORMATION_SCHEMA queries, see Section 8.2.3, “Optimizing INFORMATION_SCHEMA Queries”.

Standards Considerations

The implementation for the INFORMATION_SCHEMA table structures in MySQL follows the ANSI/ISO SQL:2003 standard Part 11 Schemata. Our intent is approximate compliance with SQL:2003 core feature F021 Basic information schema.

Users of SQL Server 2000 (which also follows the standard) may notice a strong similarity. However, MySQL has omitted many columns that are not relevant for our implementation, and added columns that are MySQL-specific. One such column is the ENGINE column in the INFORMATION_SCHEMA.TABLES table.

Although other DBMSs use a variety of names, like syscat or system, the standard name is INFORMATION_SCHEMA.

To avoid using any name that is reserved in the standard or in DB2, SQL Server, or Oracle, we changed the names of some columns marked MySQL extension. (For example, we changed COLLATION to TABLE_COLLATION in the TABLES table.) See the list of reserved words near the end of this article: https://web.archive.org/web/20070428032454/http://www.dbazine.com/db2/db2-disarticles/gulutzan5.

Conventions in the INFORMATION_SCHEMA Reference Sections

The following sections describe each of the tables and columns in INFORMATION_SCHEMA. For each column, there are three pieces of information:

Many sections indicate what SHOW statement is equivalent to a SELECT that retrieves information from INFORMATION_SCHEMA. For SHOW statements that display information for the default database if you omit a FROM db_name clause, you can often select information for the default database by adding an AND TABLE_SCHEMA = SCHEMA() condition to the WHERE clause of a query that retrieves information from an INFORMATION_SCHEMA table.

Related Information

These sections discuss additional INFORMATION_SCHEMA-related topics:

24.1 The INFORMATION_SCHEMA CHARACTER_SETS Table

The CHARACTER_SETS table provides information about available character sets.

INFORMATION_SCHEMA Name SHOW Name Remarks
CHARACTER_SET_NAME Charset
DEFAULT_COLLATE_NAME Default collation
DESCRIPTION Description MySQL extension
MAXLEN Maxlen MySQL extension

The following statements are equivalent:

SELECT * FROM INFORMATION_SCHEMA.CHARACTER_SETS
  [WHERE CHARACTER_SET_NAME LIKE 'wild']

SHOW CHARACTER SET
  [LIKE 'wild']

24.2 The INFORMATION_SCHEMA COLLATIONS Table

The COLLATIONS table provides information about collations for each character set.

INFORMATION_SCHEMA Name SHOW Name Remarks
COLLATION_NAME Collation
CHARACTER_SET_NAME Charset MySQL extension
ID Id MySQL extension
IS_DEFAULT Default MySQL extension
IS_COMPILED Compiled MySQL extension
SORTLEN Sortlen MySQL extension
PAD_ATTRIBUTE omit
  • COLLATION_NAME is the collation name.

  • CHARACTER_SET_NAME is the name of the character set with which the collation is associated.

  • ID is the collation ID.

  • IS_DEFAULT indicates whether the collation is the default for its character set.

  • IS_COMPILED indicates whether the character set is compiled into the server.

  • SORTLEN is related to the amount of memory required to sort strings expressed in the character set.

  • PAD_ATTRIBUTE indicates the collation pad attribute.

Collation information is also available from the SHOW COLLATION statement. The following statements are equivalent:

SELECT COLLATION_NAME FROM INFORMATION_SCHEMA.COLLATIONS
  [WHERE COLLATION_NAME LIKE 'wild']

SHOW COLLATION
  [LIKE 'wild']

24.3 The INFORMATION_SCHEMA COLLATION_CHARACTER_SET_APPLICABILITY Table

The COLLATION_CHARACTER_SET_APPLICABILITY table indicates what character set is applicable for what collation. The columns are equivalent to the first two display fields that we get from SHOW COLLATION.

INFORMATION_SCHEMA Name SHOW Name Remarks
COLLATION_NAME Collation
CHARACTER_SET_NAME Charset

24.4 The INFORMATION_SCHEMA COLUMNS Table

The COLUMNS table provides information about columns in tables.

The related ST_GEOMETRY_COLUMNS table is a view on COLUMNS that provides information about table columns that store spatial data. See Section 24.24, “The INFORMATION_SCHEMA ST_GEOMETRY_COLUMNS Table”.

INFORMATION_SCHEMA Name SHOW Name Remarks
TABLE_CATALOG def
TABLE_SCHEMA
TABLE_NAME
COLUMN_NAME Field
ORDINAL_POSITION see notes
COLUMN_DEFAULT Default
IS_NULLABLE Null
DATA_TYPE Type
CHARACTER_MAXIMUM_LENGTH Type
CHARACTER_OCTET_LENGTH
NUMERIC_PRECISION Type
NUMERIC_SCALE Type
DATETIME_PRECISION Type
CHARACTER_SET_NAME
COLLATION_NAME Collation
COLUMN_TYPE Type MySQL extension
COLUMN_KEY Key MySQL extension
EXTRA Extra MySQL extension
PRIVILEGES Privileges MySQL extension
COLUMN_COMMENT Comment MySQL extension
GENERATION_EXPRESSION MySQL extension
SRS_ID MySQL extension

Notes:

  • In SHOW, the Type display includes values from several different COLUMNS columns.

  • ORDINAL_POSITION is necessary because you might want to say ORDER BY ORDINAL_POSITION. Unlike SHOW, SELECT does not have automatic ordering.

  • CHARACTER_OCTET_LENGTH should be the same as CHARACTER_MAXIMUM_LENGTH, except for multibyte character sets.

  • CHARACTER_SET_NAME can be derived from Collation. For example, if you say SHOW FULL COLUMNS FROM t, and you see in the Collation column a value of utf8_swedish_ci, the character set is what is before the first underscore: utf8.

  • GENERATION_EXPRESSION is nonempty for generated columns and displays the expression used to compute column values. For information about generated columns, see Section 13.1.18.8, “CREATE TABLE and Generated Columns”.

  • The EXTRA column contains VIRTUAL GENERATED or VIRTUAL STORED for generated columns.

  • SRS_ID applies to spatial columns. It contains the column SRID value that indicates the the spatial reference system for values stored in the column. See Section 11.5.1, “Spatial Data Types”, and Section 11.5.5, “Spatial Reference System Support”. The value is NULL for nonspatial columns and spatial columns with no SRID attribute. SRS_ID was added in MySQL 8.0-3.

The following statements are nearly equivalent:

SELECT COLUMN_NAME, DATA_TYPE, IS_NULLABLE, COLUMN_DEFAULT
  FROM INFORMATION_SCHEMA.COLUMNS
  WHERE table_name = 'tbl_name'
  [AND table_schema = 'db_name']
  [AND column_name LIKE 'wild']

SHOW COLUMNS
  FROM tbl_name
  [FROM db_name]
  [LIKE 'wild']

24.5 The INFORMATION_SCHEMA COLUMN_PRIVILEGES Table

The COLUMN_PRIVILEGES table provides information about column privileges. This information comes from the mysql.columns_priv grant table.

INFORMATION_SCHEMA Name SHOW Name Remarks
GRANTEE 'user_name'@'host_name' value
TABLE_CATALOG def
TABLE_SCHEMA
TABLE_NAME
COLUMN_NAME
PRIVILEGE_TYPE
IS_GRANTABLE

Notes:

  • In the output from SHOW FULL COLUMNS, the privileges are all in one field and in lowercase, for example, select,insert,update,references. In COLUMN_PRIVILEGES, there is one privilege per row, in uppercase.

  • PRIVILEGE_TYPE can contain one (and only one) of these values: SELECT, INSERT, UPDATE, REFERENCES.

  • If the user has GRANT OPTION privilege, IS_GRANTABLE should be YES. Otherwise, IS_GRANTABLE should be NO. The output does not list GRANT OPTION as a separate privilege.

The following statements are not equivalent:

SELECT ... FROM INFORMATION_SCHEMA.COLUMN_PRIVILEGES

SHOW GRANTS ...

24.6 The INFORMATION_SCHEMA COLUMN_STATISTICS Table

The COLUMN_STATISTICS table is a view that provides access to information in the column_statistics data dictionary table, which stores histogram statistics about column values.

For information about histogram statistics, see Section 8.9.6, “Optimizer Statistics”, and Section 13.7.3.1, “ANALYZE TABLE Syntax”.

You can see information only for columns for which you have some privilege.

COLUMN_STATISTICS has these columns:

  • SCHEMA_NAME

    The names of the schema for which the statistics apply.

  • TABLE_NAME

    The names of the column for which the statistics apply.

  • COLUMN_NAME

    The names of the column for which the statistics apply.

  • HISTOGRAM

    A JSON object describing the column statistics, stored as a histogram.

24.7 The INFORMATION_SCHEMA ENGINES Table

The ENGINES table provides information about storage engines.

INFORMATION_SCHEMA Name SHOW Name Remarks
ENGINE Engine MySQL extension
SUPPORT Support MySQL extension
COMMENT Comment MySQL extension
TRANSACTIONS Transactions MySQL extension
XA XA MySQL extension
SAVEPOINTS Savepoints MySQL extension

Notes:

See also Section 13.7.6.16, “SHOW ENGINES Syntax”.

24.8 The INFORMATION_SCHEMA EVENTS Table

The EVENTS table provides information about scheduled events, which are discussed in Section 23.4, “Using the Event Scheduler”. The SHOW Name values correspond to column names of the SHOW EVENTS statement.

INFORMATION_SCHEMA Name SHOW Name Remarks
EVENT_CATALOG def, MySQL extension
EVENT_SCHEMA Db MySQL extension
EVENT_NAME Name MySQL extension
DEFINER Definer MySQL extension
TIME_ZONE Time zone MySQL extension
EVENT_BODY MySQL extension
EVENT_DEFINITION MySQL extension
EVENT_TYPE Type MySQL extension
EXECUTE_AT Execute at MySQL extension
INTERVAL_VALUE Interval value MySQL extension
INTERVAL_FIELD Interval field MySQL extension
SQL_MODE MySQL extension
STARTS Starts MySQL extension
ENDS Ends MySQL extension
STATUS Status MySQL extension
ON_COMPLETION MySQL extension
CREATED MySQL extension
LAST_ALTERED MySQL extension
LAST_EXECUTED MySQL extension
EVENT_COMMENT MySQL extension
ORIGINATOR Originator MySQL extension
CHARACTER_SET_CLIENT character_set_client MySQL extension
COLLATION_CONNECTION collation_connection MySQL extension
DATABASE_COLLATION Database Collation MySQL extension

Notes:

  • The EVENTS table is a nonstandard table.

  • EVENT_CATALOG: The value of this column is always def.

  • EVENT_SCHEMA: The name of the schema (database) to which this event belongs.

  • EVENT_NAME: The name of the event.

  • DEFINER: The account of the user who created the event, in 'user_name'@'host_name' format.

  • TIME_ZONE: The event time zone, which is the time zone used for scheduling the event and that is in effect within the event as it executes. The default value is SYSTEM.

  • EVENT_BODY: The language used for the statements in the event's DO clause; in MySQL 8.0, this is always SQL.

    This column is not to be confused with the column of the same name (now named EVENT_DEFINITION) that existed in earlier MySQL versions.

  • EVENT_DEFINITION: The text of the SQL statement making up the event's DO clause; in other words, the statement executed by this event.

  • EVENT_TYPE: The event repetition type, either ONE TIME (transient) or RECURRING (repeating).

  • EXECUTE_AT: For a one-time event, this is the DATETIME value specified in the AT clause of the CREATE EVENT statement used to create the event, or of the last ALTER EVENT statement that modified the event. The value shown in this column reflects the addition or subtraction of any INTERVAL value included in the event's AT clause. For example, if an event is created using ON SCHEDULE AT CURRENT_TIMESTAMP + '1:6' DAY_HOUR, and the event was created at 2006-02-09 14:05:30, the value shown in this column would be '2006-02-10 20:05:30'.

    If the event's timing is determined by an EVERY clause instead of an AT clause (that is, if the event is recurring), the value of this column is NULL.

  • INTERVAL_VALUE: For recurring events, this column contains the numeric portion of the event's EVERY clause.

    For a one-time event (that is, an event whose timing is determined by an AT clause), this column is NULL.

  • INTERVAL_FIELD: For recurring events, this column contains the units portion of the EVERY clause governing the timing of the event. Thus, this column contains a value such as 'YEAR', 'QUARTER', 'DAY', and so on.

    For a one-time event (that is, an event whose timing is determined by an AT clause), this column is NULL.

  • SQL_MODE: The SQL mode in effect when the event was created or altered, and under which the event executes. For the permitted values, see Section 5.1.10, “Server SQL Modes”.

  • STARTS: For a recurring event whose definition includes a STARTS clause, this column contains the corresponding DATETIME value. As with the EXECUTE_AT column, this value resolves any expressions used.

    If there is no STARTS clause affecting the timing of the event, this column is NULL

  • ENDS: For a recurring event whose definition includes a ENDS clause, this column contains the corresponding DATETIME value. As with the EXECUTE_AT column, this value resolves any expressions used.

    If there is no ENDS clause affecting the timing of the event, this column is NULL.

  • STATUS: One of the three values ENABLED, DISABLED, or SLAVESIDE_DISABLED.

    SLAVESIDE_DISABLED indicates that the creation of the event occurred on another MySQL server acting as a replication master and was replicated to the current MySQL server which is acting as a slave, but the event is not presently being executed on the slave. See Section 17.4.1.16, “Replication of Invoked Features”, for more information.

  • ON_COMPLETION: One of the two values PRESERVE or NOT PRESERVE.

  • CREATED: The date and time when the event was created. This is a TIMESTAMP value.

  • LAST_ALTERED: The date and time when the event was last modified. This is a TIMESTAMP value. If the event has not been modified since its creation, this column holds the same value as the CREATED column.

  • LAST_EXECUTED: The date and time when the event last executed. A DATETIME value. If the event has never executed, this column is NULL.

    LAST_EXECUTED indicates when the event started. As a result, the ENDS column is never less than LAST_EXECUTED.

  • EVENT_COMMENT: The text of a comment, if the event has one. If not, the value of this column is an empty string.

  • ORIGINATOR: The server ID of the MySQL server on which the event was created; used in replication. The default value is 0.

  • CHARACTER_SET_CLIENT: The session value of the character_set_client system variable when the event was created.

  • COLLATION_CONNECTION: The session value of the collation_connection system variable when the event was created.

  • DATABASE_COLLATION: The collation of the database with which the event is associated.

Example: Suppose that the user jon@ghidora creates an event named e_daily, and then modifies it a few minutes later using an ALTER EVENT statement, as shown here:

DELIMITER |

CREATE EVENT e_daily
    ON SCHEDULE
      EVERY 1 DAY
    COMMENT 'Saves total number of sessions then clears the table each day'
    DO
      BEGIN
        INSERT INTO site_activity.totals (time, total)
          SELECT CURRENT_TIMESTAMP, COUNT(*)
            FROM site_activity.sessions;
        DELETE FROM site_activity.sessions;
      END |

DELIMITER ;

ALTER EVENT e_daily
    ENABLE;

(Note that comments can span multiple lines.)

This user can then run the following SELECT statement, and obtain the output shown:

mysql> SELECT * FROM INFORMATION_SCHEMA.EVENTS
     > WHERE EVENT_NAME = 'e_daily'
     > AND EVENT_SCHEMA = 'myschema'\G
*************************** 1. row ***************************
       EVENT_CATALOG: def
        EVENT_SCHEMA: test
          EVENT_NAME: e_daily
             DEFINER: me@localhost
           TIME_ZONE: SYSTEM
          EVENT_BODY: SQL
    EVENT_DEFINITION: BEGIN
        INSERT INTO site_activity.totals (time, total)
          SELECT CURRENT_TIMESTAMP, COUNT(*)
            FROM site_activity.sessions;
        DELETE FROM site_activity.sessions;
      END
          EVENT_TYPE: RECURRING
          EXECUTE_AT: NULL
      INTERVAL_VALUE: 1
      INTERVAL_FIELD: DAY
            SQL_MODE:
              STARTS: 2008-09-03 12:13:39
                ENDS: NULL
              STATUS: ENABLED
       ON_COMPLETION: NOT PRESERVE
             CREATED: 2008-09-03 12:13:39
        LAST_ALTERED: 2008-09-03 12:13:39
       LAST_EXECUTED: NULL
       EVENT_COMMENT: Saves total number of sessions then clears the
                      table each day
          ORIGINATOR: 1
CHARACTER_SET_CLIENT: utf8
COLLATION_CONNECTION: utf8_swedish_ci
  DATABASE_COLLATION: utf8_swedish_ci

Times in the EVENTS table are displayed using the event time zone or the current session time zone, as described in Section 23.4.4, “Event Metadata”.

See also Section 13.7.6.18, “SHOW EVENTS Syntax”.

24.9 The INFORMATION_SCHEMA FILES Table

The FILES table provides information about the files in which MySQL tablespace data is stored.

INFORMATION_SCHEMA.FILES reports data about NDB and InnoDB data files.

INFORMATION_SCHEMA Name SHOW Name Remarks
FILE_ID MySQL extension
FILE_NAME MySQL extension
FILE_TYPE MySQL extension
TABLESPACE_NAME MySQL extension
TABLE_CATALOG MySQL extension
TABLE_SCHEMA MySQL extension
TABLE_NAME MySQL extension
LOGFILE_GROUP_NAME MySQL extension
LOGFILE_GROUP_NUMBER MySQL extension
ENGINE MySQL extension
FULLTEXT_KEYS MySQL extension
DELETED_ROWS MySQL extension
UPDATE_COUNT MySQL extension
FREE_EXTENTS MySQL extension
TOTAL_EXTENTS MySQL extension
EXTENT_SIZE MySQL extension
INITIAL_SIZE MySQL extension
MAXIMUM_SIZE MySQL extension
AUTOEXTEND_SIZE MySQL extension
CREATION_TIME MySQL extension
LAST_UPDATE_TIME MySQL extension
LAST_ACCESS_TIME MySQL extension
RECOVER_TIME MySQL extension
TRANSACTION_COUNTER MySQL extension
VERSION MySQL extension
ROW_FORMAT MySQL extension
TABLE_ROWS MySQL extension
AVG_ROW_LENGTH MySQL extension
DATA_LENGTH MySQL extension
MAX_DATA_LENGTH MySQL extension
INDEX_LENGTH MySQL extension
DATA_FREE MySQL extension
CREATE_TIME MySQL extension
UPDATE_TIME MySQL extension
CHECK_TIME MySQL extension
CHECKSUM MySQL extension
STATUS MySQL extension
EXTRA MySQL extension

InnoDB Notes:

The following notes apply to InnoDB data files. INFORMATION_SCHEMA.FILES fields that are not described below are not applicable to InnoDB and report a NULL value.

  • Data reported by INFORMATION_SCHEMA.FILES is reported from the InnoDB in-memory cache for open files. By comparison, INFORMATION_SCHEMA.INNODB_DATAFILES reports data from the InnoDB SYS_DATAFILES internal data dictionary table.

  • The data reported by INFORMATION_SCHEMA.FILES includes temporary tablespace data. This data is not available in the internal SYS_DATAFILES data dictionary table, and is therefore not reported by INNODB_DATAFILES.

  • Undo tablespace data is reported by INFORMATION_SCHEMA.FILES when separate undo tablespaces are present, which they are by default in MySQL 8.0

  • FILE_ID is the tablespace ID, also referred to as the space_id or fil_space_t::id.

  • FILE_NAME is the name of the data file. File-per-table and general tablespaces have a .ibd file name extension. Undo tablespaces are prefixed by undo. The system tablespace is prefixed by ibdata. Temporary tablespaces are prefixed by ibtmp. The file name includes the file path, which may be relative to the MySQL data directory (datadir).

  • FILE_TYPE is the tablespace file type. There are three possible file types for InnoDB files. TABLESPACE is the file type for any system, general, or file-per-table tablespace file that holds tables, indexes, or other forms of user data. TEMPORARY is the file type for temporary tablespaces. UNDO LOG is the file type for undo tablespaces, which hold undo records.

  • TABLESPACE_NAME is the SQL name for the tablespace. A general tablespace name is the SYS_TABLESPACES.NAME value. For other tablespace files, names start with innodb_, such as innodb_system, innodb_undo, and innodb_file_per_table. The file-per-table tablespace name format is innodb_file_per_table_##, where ## is the tablespace ID.

  • ENGINE is the storage engine. For InnoDB files, the value is always InnoDB.

  • FREE_EXTENTS is the number of fully free extents in the current data file.

  • TOTAL_EXTENTS is the number of full extents used in the current data file. Any partial extent at the end of the file is not counted.

  • EXTENT_SIZE is 1048576 (1MB) for files with a 4k, 8k, or 16k page size. Extent size is 2097152 bytes (2MB) for files with a 32k page size, and 4194304 (4MB) for files with a 64k page size. INFORMATION_SCHEMA.FILES does not report InnoDB page size. Page size is defined by the innodb_page_size option. Extent size information can also be retrieved from INNODB_TABLESPACES where FILES.FILE_ID = INNODB_TABLESPACES.SPACE_ID.

  • INITIAL_SIZE is the initial size of the file, in bytes.

  • MAXIMUM_SIZE is the maximum number of bytes allowed in the file. The value is NULL for all data files except for predefined system tablespace data files. Maximum system tablespace file size is defined by innodb_data_file_path. Maximum temporary tablespace file size is defined by innodb_temp_data_file_path. A NULL value for a predefined system tablespace data file indicates that a file size limit was not defined explicitly.

  • AUTOEXTEND_SIZE is the auto-extend size defined by innodb_data_file_path for the system tablespace, or defined by innodb_temp_data_file_path for temporary tablespaces.

  • DATA_FREE is the total amount of free space (in bytes) for the entire tablespace. Predefined system tablespaces, which include the system tablespace and temporary table tablespaces, may have one or more data files.

  • STATUS is NORMAL by default. InnoDB file-per-table tablespaces may report IMPORTING, which indicates that the tablespace is not yet available.

  • The following query returns all data pertinent to InnoDB tablespaces.

    mysql>SELECT FILE_ID, FILE_NAME, FILE_TYPE, TABLESPACE_NAME, FREE_EXTENTS, TOTAL_EXTENTS,
    EXTENT_SIZE, INITIAL_SIZE, MAXIMUM_SIZE, AUTOEXTEND_SIZE, DATA_FREE, STATUS ENGINE
    FROM INFORMATION_SCHEMA.FILES \G

24.10 The INFORMATION_SCHEMA KEY_COLUMN_USAGE Table

The KEY_COLUMN_USAGE table describes which key columns have constraints.

INFORMATION_SCHEMA Name SHOW Name Remarks
CONSTRAINT_CATALOG def
CONSTRAINT_SCHEMA
CONSTRAINT_NAME
TABLE_CATALOG def
TABLE_SCHEMA
TABLE_NAME
COLUMN_NAME
ORDINAL_POSITION
POSITION_IN_UNIQUE_CONSTRAINT
REFERENCED_TABLE_SCHEMA
REFERENCED_TABLE_NAME
REFERENCED_COLUMN_NAME

Notes:

  • If the constraint is a foreign key, then this is the column of the foreign key, not the column that the foreign key references.

  • The value of ORDINAL_POSITION is the column's position within the constraint, not the column's position within the table. Column positions are numbered beginning with 1.

  • The value of POSITION_IN_UNIQUE_CONSTRAINT is NULL for unique and primary-key constraints. For foreign-key constraints, it is the ordinal position in key of the table that is being referenced.

    Suppose that there are two tables name t1 and t3 that have the following definitions:

    CREATE TABLE t1
    (
        s1 INT,
        s2 INT,
        s3 INT,
        PRIMARY KEY(s3)
    ) ENGINE=InnoDB;
    
    CREATE TABLE t3
    (
        s1 INT,
        s2 INT,
        s3 INT,
        KEY(s1),
        CONSTRAINT CO FOREIGN KEY (s2) REFERENCES t1(s3)
    ) ENGINE=InnoDB;
    

    For those two tables, the KEY_COLUMN_USAGE table has two rows:

    • One row with CONSTRAINT_NAME = 'PRIMARY', TABLE_NAME = 't1', COLUMN_NAME = 's3', ORDINAL_POSITION = 1, POSITION_IN_UNIQUE_CONSTRAINT = NULL.

    • One row with CONSTRAINT_NAME = 'CO', TABLE_NAME = 't3', COLUMN_NAME = 's2', ORDINAL_POSITION = 1, POSITION_IN_UNIQUE_CONSTRAINT = 1.

24.11 The INFORMATION_SCHEMA KEYWORDS Table

The KEYWORDS table lists the words considered keywords by MySQL and, for each one, indicates whether it is reserved. Reserved keywords may require special treatment in some contexts, such as special quoting when used as identifiers (see Section 9.3, “Keywords and Reserved Words”). This table provides applications a runtime source of MySQL keyword information.

Note

Currently, selecting from KEYWORDS returns an empty result unless some default database has been selected.

The KEYWORDS table has these columns:

  • WORD

    The keyword.

  • RESERVED

    An integer indicating whether the keyword is reserved (1) or nonreserved (0).

These queries lists all keywords, all reserved keywords, and all nonreserved keywords, respectively:

SELECT * FROM INFORMATION_SCHEMA.KEYWORDS;
SELECT WORD FROM INFORMATION_SCHEMA.KEYWORDS WHERE RESERVED = 1;
SELECT WORD FROM INFORMATION_SCHEMA.KEYWORDS WHERE RESERVED = 0;

The latter two queries are equivalent to:

SELECT WORD FROM INFORMATION_SCHEMA.KEYWORDS WHERE RESERVED;
SELECT WORD FROM INFORMATION_SCHEMA.KEYWORDS WHERE NOT RESERVED;

If you build MySQL from source, the build process generates a keyword_list.h header file containing an array of keywords and their reserved status. This file can be found in the sql directory under the build directory. This file may be useful for applications that require a static source for the keyword list.

24.12 The INFORMATION_SCHEMA OPTIMIZER_TRACE Table

The OPTIMIZER_TRACE table provides information produced by the optimizer tracing capability. To enable tracking, use the optimizer_trace system variable. For details, see MySQL Internals: Tracing the Optimizer.

24.13 The INFORMATION_SCHEMA PARAMETERS Table

The PARAMETERS table provides information about stored procedure and function parameters, and about return values for stored functions.

INFORMATION_SCHEMA Name Remarks
SPECIFIC_CATALOG def
SPECIFIC_SCHEMA routine database
SPECIFIC_NAME routine name
ORDINAL_POSITION 1, 2, 3, ... for parameters, 0 for function RETURNS clause
PARAMETER_MODE IN, OUT, INOUT (NULL for RETURNS)
PARAMETER_NAME parameter name (NULL for RETURNS)
DATA_TYPE same as for COLUMNS table
CHARACTER_MAXIMUM_LENGTH same as for COLUMNS table
CHARACTER_OCTET_LENGTH same as for COLUMNS table
NUMERIC_PRECISION same as for COLUMNS table
NUMERIC_SCALE same as for COLUMNS table
DATETIME_PRECISION same as for COLUMNS table
CHARACTER_SET_NAME same as for COLUMNS table
COLLATION_NAME same as for COLUMNS table
DTD_IDENTIFIER same as for COLUMNS table
ROUTINE_TYPE same as for ROUTINES table

Notes:

  • For successive parameters of a stored procedure or function, the ORDINAL_POSITION values are 1, 2, 3, and so forth. For a stored function, there is also a row that describes the data type for the RETURNS clause. The return value is not a true parameter, so the row that describes it has these unique characteristics:

    • The ORDINAL_POSITION value is 0.

    • The PARAMETER_NAME and PARAMETER_MODE values are NULL because the return value has no name and the mode does not apply.

24.14 The INFORMATION_SCHEMA PARTITIONS Table

The PARTITIONS table provides information about table partitions. See Chapter 22, Partitioning, for more information about partitioning tables.

INFORMATION_SCHEMA Name SHOW Name Remarks
TABLE_CATALOG MySQL extension
TABLE_SCHEMA MySQL extension
TABLE_NAME MySQL extension
PARTITION_NAME MySQL extension
SUBPARTITION_NAME MySQL extension
PARTITION_ORDINAL_POSITION MySQL extension
SUBPARTITION_ORDINAL_POSITION MySQL extension
PARTITION_METHOD MySQL extension
SUBPARTITION_METHOD MySQL extension
PARTITION_EXPRESSION MySQL extension
SUBPARTITION_EXPRESSION MySQL extension
PARTITION_DESCRIPTION MySQL extension
TABLE_ROWS MySQL extension
AVG_ROW_LENGTH MySQL extension
DATA_LENGTH MySQL extension
MAX_DATA_LENGTH MySQL extension
INDEX_LENGTH MySQL extension
DATA_FREE MySQL extension
CREATE_TIME MySQL extension
UPDATE_TIME MySQL extension
CHECK_TIME MySQL extension
CHECKSUM MySQL extension
PARTITION_COMMENT MySQL extension
NODEGROUP MySQL extension
TABLESPACE_NAME MySQL extension

Notes:

  • The PARTITIONS table is a nonstandard table.

    Each record in this table corresponds to an individual partition or subpartition of a partitioned table.

  • TABLE_CATALOG: This column is always def.

  • TABLE_SCHEMA: This column contains the name of the database to which the table belongs.

  • TABLE_NAME: This column contains the name of the table containing the partition.

  • PARTITION_NAME: The name of the partition.

  • SUBPARTITION_NAME: If the PARTITIONS table record represents a subpartition, then this column contains the name of subpartition; otherwise it is NULL.

  • PARTITION_ORDINAL_POSITION: All partitions are indexed in the same order as they are defined, with 1 being the number assigned to the first partition. The indexing can change as partitions are added, dropped, and reorganized; the number shown is this column reflects the current order, taking into account any indexing changes.

  • SUBPARTITION_ORDINAL_POSITION: Subpartitions within a given partition are also indexed and reindexed in the same manner as partitions are indexed within a table.

  • PARTITION_METHOD: One of the values RANGE, LIST, HASH, LINEAR HASH, KEY, or LINEAR KEY; that is, one of the available partitioning types as discussed in Section 22.2, “Partitioning Types”.

  • SUBPARTITION_METHOD: One of the values HASH, LINEAR HASH, KEY, or LINEAR KEY; that is, one of the available subpartitioning types as discussed in Section 22.2.6, “Subpartitioning”.

  • PARTITION_EXPRESSION: This is the expression for the partitioning function used in the CREATE TABLE or ALTER TABLE statement that created the table's current partitioning scheme.

    For example, consider a partitioned table created in the test database using this statement:

    CREATE TABLE tp (
        c1 INT,
        c2 INT,
        c3 VARCHAR(25)
    )
    PARTITION BY HASH(c1 + c2)
    PARTITIONS 4;
    

    The PARTITION_EXPRESSION column in a PARTITIONS table record for a partition from this table displays c1 + c2, as shown here:

    mysql> SELECT DISTINCT PARTITION_EXPRESSION
         >     FROM INFORMATION_SCHEMA.PARTITIONS
         >     WHERE TABLE_NAME='tp' AND TABLE_SCHEMA='test';
    +----------------------+
    | PARTITION_EXPRESSION |
    +----------------------+
    | c1 + c2              |
    +----------------------+
    1 row in set (0.09 sec)
    
  • SUBPARTITION_EXPRESSION: This works in the same fashion for the subpartitioning expression that defines the subpartitioning for a table as PARTITION_EXPRESSION does for the partitioning expression used to define a table's partitioning.

    If the table has no subpartitions, then this column is NULL.

  • PARTITION_DESCRIPTION: This column is used for RANGE and LIST partitions. For a RANGE partition, it contains the value set in the partition's VALUES LESS THAN clause, which can be either an integer or MAXVALUE. For a LIST partition, this column contains the values defined in the partition's VALUES IN clause, which is a comma-separated list of integer values.

    For partitions whose PARTITION_METHOD is other than RANGE or LIST, this column is always NULL.

  • TABLE_ROWS: The number of table rows in the partition.

    For partitioned InnoDB tables, the row count given in the TABLE_ROWS column is only an estimated value used in SQL optimization, and may not always be exact.

  • AVG_ROW_LENGTH: The average length of the rows stored in this partition or subpartition, in bytes.

    This is the same as DATA_LENGTH divided by TABLE_ROWS.

  • DATA_LENGTH: The total length of all rows stored in this partition or subpartition, in bytes—that is, the total number of bytes stored in the partition or subpartition.

  • MAX_DATA_LENGTH: The maximum number of bytes that can be stored in this partition or subpartition.

  • INDEX_LENGTH: The length of the index file for this partition or subpartition, in bytes.

  • DATA_FREE: The number of bytes allocated to the partition or subpartition but not used.

  • CREATE_TIME: The time of the partition's or subpartition's creation.

  • UPDATE_TIME: The time that the partition or subpartition was last modified.

  • CHECK_TIME: The last time that the table to which this partition or subpartition belongs was checked.

    For partitioned InnoDB tables, this column is always NULL.

  • CHECKSUM: The checksum value, if any; otherwise, this column is NULL.

  • PARTITION_COMMENT: This column contains the text of any comment made for the partition.

    In MySQL 8.0, the maximum length for a partition comment is defined as 1024 characters, and the display width of the PARTITION_COMMENT column is also 1024, characters to match this limit (Bug #11748924, Bug #37728).

    The default value for this column is an empty string.

  • NODEGROUP: This is the nodegroup to which the partition belongs. This is relevant only to MySQL Cluster tables; otherwise the value of this column is always 0.

  • TABLESPACE_NAME: This column contains the name of the tablespace to which the partition belongs. The value of this column is always DEFAULT.

  • A nonpartitioned table has one record in INFORMATION_SCHEMA.PARTITIONS; however, the values of the PARTITION_NAME, SUBPARTITION_NAME, PARTITION_ORDINAL_POSITION, SUBPARTITION_ORDINAL_POSITION, PARTITION_METHOD, SUBPARTITION_METHOD, PARTITION_EXPRESSION, SUBPARTITION_EXPRESSION, and PARTITION_DESCRIPTION columns are all NULL. (The PARTITION_COMMENT column in this case is blank.)

24.15 The INFORMATION_SCHEMA PLUGINS Table

The PLUGINS table provides information about server plugins.

INFORMATION_SCHEMA Name SHOW Name Remarks
PLUGIN_NAME Name MySQL extension
PLUGIN_VERSION MySQL extension
PLUGIN_STATUS Status MySQL extension
PLUGIN_TYPE Type MySQL extension
PLUGIN_TYPE_VERSION MySQL extension
PLUGIN_LIBRARY Library MySQL extension
PLUGIN_LIBRARY_VERSION MySQL extension
PLUGIN_AUTHOR MySQL extension
PLUGIN_DESCRIPTION MySQL extension
PLUGIN_LICENSE License MySQL extension
LOAD_OPTION MySQL extension

Notes:

  • The PLUGINS table is a nonstandard table.

  • PLUGIN_NAME is the name used to refer to the plugin in statements such as INSTALL PLUGIN and UNINSTALL PLUGIN.

  • PLUGIN_VERSION is the version from the plugin's general type descriptor.

  • PLUGIN_STATUS indicates the plugin status, one of ACTIVE, INACTIVE, DISABLED, DELETING, or DELETED.

  • PLUGIN_TYPE indicates the type of plugin, such as STORAGE ENGINE, INFORMATION_SCHEMA, or AUTHENTICATION.

  • PLUGIN_TYPE_VERSION is the version from the plugin's type-specific descriptor.

  • PLUGIN_LIBRARY is the name of the plugin shared library file. This is the name used to refer to the plugin file in statements such as INSTALL PLUGIN and UNINSTALL PLUGIN. This file is located in the directory named by the plugin_dir system variable. If the library name is NULL, the plugin is compiled in and cannot be uninstalled with UNINSTALL PLUGIN.

  • PLUGIN_LIBRARY_VERSION indicates the plugin API interface version.

  • PLUGIN_AUTHOR names the plugin author.

  • PLUGIN_DESCRIPTION provides a short description of the plugin.

  • PLUGIN_LICENSE indicates how the plugin is licensed; for example, GPL.

  • LOAD_OPTION indicates how the plugin was loaded. The value is OFF, ON, FORCE, or FORCE_PLUS_PERMANENT. See Section 5.6.1, “Installing and Uninstalling Plugins”.

For plugins installed with INSTALL PLUGIN, the PLUGIN_NAME and PLUGIN_LIBRARY values are also registered in the mysql.plugin table.

These statements are equivalent:

SELECT
  PLUGIN_NAME, PLUGIN_STATUS, PLUGIN_TYPE,
  PLUGIN_LIBRARY, PLUGIN_LICENSE
FROM INFORMATION_SCHEMA.PLUGINS;

SHOW PLUGINS;

For information about plugin data structures that form the basis of the information in the PLUGINS table, see Section 28.2, “The MySQL Plugin API”.

Plugin information is also available using the SHOW PLUGINS statement. See Section 13.7.6.25, “SHOW PLUGINS Syntax”.

24.16 The INFORMATION_SCHEMA PROCESSLIST Table

The PROCESSLIST table provides information about which threads are running.

INFORMATION_SCHEMA Name SHOW Name Remarks
ID Id MySQL extension
USER User MySQL extension
HOST Host MySQL extension
DB db MySQL extension
COMMAND Command MySQL extension
TIME Time MySQL extension
STATE State MySQL extension
INFO Info MySQL extension

For an extensive description of the table columns, see Section 13.7.6.29, “SHOW PROCESSLIST Syntax”.

Notes:

  • The PROCESSLIST table is a nonstandard table.

  • Like the output from the corresponding SHOW statement, the PROCESSLIST table will only show information about your own threads, unless you have the PROCESS privilege, in which case you will see information about other threads, too. As an anonymous user, you cannot see any rows at all.

  • If an SQL statement refers to INFORMATION_SCHEMA.PROCESSLIST, MySQL populates the entire table once, when statement execution begins, so there is read consistency during the statement. There is no read consistency for a multi-statement transaction, though.

  • Process information is also available from the performance_schema.threads table. However, access to threads does not require a mutex and has minimal impact on server performance. INFORMATION_SCHEMA.PROCESSLIST and SHOW PROCESSLIST have negative performance consequences because they require a mutex. threads also shows information about background threads, which INFORMATION_SCHEMA.PROCESSLIST and SHOW PROCESSLIST do not. This means that threads can be used to monitor activity the other thread information sources cannot.

The following statements are equivalent:

SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST

SHOW FULL PROCESSLIST

24.17 The INFORMATION_SCHEMA PROFILING Table

The PROFILING table provides statement profiling information. Its contents correspond to the information produced by the SHOW PROFILES and SHOW PROFILE statements (see Section 13.7.6.31, “SHOW PROFILES Syntax”). The table is empty unless the profiling session variable is set to 1.

Note

This table is deprecated and will be removed in a future MySQL release. Use the Performance Schema instead; see Chapter 25, MySQL Performance Schema.

INFORMATION_SCHEMA Name SHOW Name Remarks
QUERY_ID Query_ID
SEQ
STATE Status
DURATION Duration
CPU_USER CPU_user
CPU_SYSTEM CPU_system
CONTEXT_VOLUNTARY Context_voluntary
CONTEXT_INVOLUNTARY Context_involuntary
BLOCK_OPS_IN Block_ops_in
BLOCK_OPS_OUT Block_ops_out
MESSAGES_SENT Messages_sent
MESSAGES_RECEIVED Messages_received
PAGE_FAULTS_MAJOR Page_faults_major
PAGE_FAULTS_MINOR Page_faults_minor
SWAPS Swaps
SOURCE_FUNCTION Source_function
SOURCE_FILE Source_file
SOURCE_LINE Source_line

Notes:

  • QUERY_ID is a numeric statement identifier.

  • SEQ is a sequence number indicating the display order for rows with the same QUERY_ID value.

  • STATE is the profiling state to which the row measurements apply.

  • DURATION indicates how long statement execution remained in the given state, in seconds.

  • CPU_USER and CPU_SYSTEM indicate user and system CPU use, in seconds.

  • CONTEXT_VOLUNTARY and CONTEXT_INVOLUNTARY indicate how many voluntary and involuntary context switches occurred.

  • BLOCK_OPS_IN and BLOCK_OPS_OUT indicate the number of block input and output operations.

  • MESSAGES_SENT and MESSAGES_RECEIVED indicate the number of communication messages sent and received.

  • PAGE_FAULTS_MAJOR and PAGE_FAULTS_MINOR indicate the number of major and minor page faults.

  • SWAPS indicates how many swaps occurred.

  • SOURCE_FUNCTION, SOURCE_FILE, and SOURCE_LINE provide information indicating where in the source code the profiled state executes.

24.18 The INFORMATION_SCHEMA REFERENTIAL_CONSTRAINTS Table

The REFERENTIAL_CONSTRAINTS table provides information about foreign keys.

INFORMATION_SCHEMA Name SHOW Name Remarks
CONSTRAINT_CATALOG def
CONSTRAINT_SCHEMA
CONSTRAINT_NAME
UNIQUE_CONSTRAINT_CATALOG def
UNIQUE_CONSTRAINT_SCHEMA
UNIQUE_CONSTRAINT_NAME
MATCH_OPTION
UPDATE_RULE
DELETE_RULE
TABLE_NAME
REFERENCED_TABLE_NAME

Notes:

  • TABLE_NAME has the same value as TABLE_NAME in INFORMATION_SCHEMA.TABLE_CONSTRAINTS.

  • CONSTRAINT_SCHEMA and CONSTRAINT_NAME identify the foreign key.

  • UNIQUE_CONSTRAINT_SCHEMA, UNIQUE_CONSTRAINT_NAME, and REFERENCED_TABLE_NAME identify the referenced key.

  • The only valid value at this time for MATCH_OPTION is NONE.

  • The possible values for UPDATE_RULE or DELETE_RULE are CASCADE, SET NULL, SET DEFAULT, RESTRICT, NO ACTION.

24.19 The INFORMATION_SCHEMA RESOURCE_GROUPS Table

The RESOURCE_GROUPS table is a view that provides access to information in the resource_groups data dictionary table that defines resource groups. For general discussion of the resource group capability, see Section 8.12.5, “Resource Groups”.

You can see information only for columns for which you have some privilege.

RESOURCE_GROUPS has these columns:

  • RESOURCE_GROUP_NAME

    The name of the resource group.

  • RESOURCE_GROUP_TYPE

    The resource group type, either SYSTEM or USER.

  • RESOURCE_GROUP_ENABLED

    Whether the resource group is enabled (1) or disabled (0);

  • VCPU_IDS

    The CPU affinity; that is, the set of virtual CPUs that the resource group can use. The value is a list of comma-separated CPU numbers or ranges.

  • THREAD_PRIORITY

    The priority for threads assigned to the resource group. The priority ranges from -20 (highest priority) to 19 (lowest priority). System resource groups have a priority that ranges from -20 to 0. User resource groups have a priority that ranges from 0 to 19.

24.20 The INFORMATION_SCHEMA ROUTINES Table

The ROUTINES table provides information about stored routines (both procedures and functions). The ROUTINES table does not include user-defined functions (UDFs).

INFORMATION_SCHEMA Name Remarks
SPECIFIC_NAME
ROUTINE_CATALOG def
ROUTINE_SCHEMA
ROUTINE_NAME
ROUTINE_TYPE {PROCEDURE|FUNCTION}
DATA_TYPE same as for COLUMNS table
CHARACTER_MAXIMUM_LENGTH same as for COLUMNS table
CHARACTER_OCTET_LENGTH same as for COLUMNS table
NUMERIC_PRECISION same as for COLUMNS table
NUMERIC_SCALE same as for COLUMNS table
DATETIME_PRECISION same as for COLUMNS table
CHARACTER_SET_NAME same as for COLUMNS table
COLLATION_NAME same as for COLUMNS table
DTD_IDENTIFIER data type descriptor
ROUTINE_BODY SQL
ROUTINE_DEFINITION
EXTERNAL_NAME NULL
EXTERNAL_LANGUAGE
PARAMETER_STYLE SQL
IS_DETERMINISTIC
SQL_DATA_ACCESS
SQL_PATH NULL
SECURITY_TYPE
CREATED
LAST_ALTERED
SQL_MODE MySQL extension
ROUTINE_COMMENT MySQL extension
DEFINER MySQL extension
CHARACTER_SET_CLIENT MySQL extension
COLLATION_CONNECTION MySQL extension
DATABASE_COLLATION MySQL extension

Notes:

  • EXTERNAL_LANGUAGE: The language of the stored routine. The value is read from the external_language column of the mysql.routines data dictionary table.

  • CREATED: The date and time when the routine was created. This is a TIMESTAMP value.

  • LAST_ALTERED: The date and time when the routine was last modified. This is a TIMESTAMP value. If the routine has not been modified since its creation, this column holds the same value as the CREATED column.

  • SQL_MODE: The SQL mode in effect when the routine was created or altered, and under which the routine executes. For the permitted values, see Section 5.1.10, “Server SQL Modes”.

  • CHARACTER_SET_CLIENT: The session value of the character_set_client system variable when the routine was created.

  • COLLATION_CONNECTION: The session value of the collation_connection system variable when the routine was created.

  • DATABASE_COLLATION: The collation of the database with which the routine is associated.

  • The DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH, NUMERIC_PRECISION, NUMERIC_SCALE, DATETIME_PRECISION, CHARACTER_SET_NAME, and COLLATION_NAME columns provide information about the data type for the RETURNS clause of stored functions. If a stored routine is a stored procedure, these columns all are NULL.

  • Information about stored function RETURNS data types is also available in the PARAMETERS table. The return value data type row for a function can be identified as the row that has an ORDINAL_POSITION value of 0.

24.21 The INFORMATION_SCHEMA SCHEMATA Table

A schema is a database, so the SCHEMATA table provides information about databases.

INFORMATION_SCHEMA Name SHOW Name Remarks
CATALOG_NAME def
SCHEMA_NAME Database
DEFAULT_CHARACTER_SET_NAME
DEFAULT_COLLATION_NAME
SQL_PATH NULL

The following statements are equivalent:

SELECT SCHEMA_NAME AS `Database`
  FROM INFORMATION_SCHEMA.SCHEMATA
  [WHERE SCHEMA_NAME LIKE 'wild']

SHOW DATABASES
  [LIKE 'wild']

24.22 The INFORMATION_SCHEMA SCHEMA_PRIVILEGES Table

The SCHEMA_PRIVILEGES table provides information about schema (database) privileges. This information comes from the mysql.db grant table.

INFORMATION_SCHEMA Name SHOW Name Remarks
GRANTEE 'user_name'@'host_name' value, MySQL extension
TABLE_CATALOG def, MySQL extension
TABLE_SCHEMA MySQL extension
PRIVILEGE_TYPE MySQL extension
IS_GRANTABLE MySQL extension

Notes:

  • This is a nonstandard table. It takes its values from the mysql.db table.

24.23 The INFORMATION_SCHEMA STATISTICS Table

The STATISTICS table provides information about table indexes.

Columns in STATISTICS that represent table statistics hold cached values. The information_schema_stats_expiry system variable defines the period of time before cached table statistics expire. The default is 86400 seconds (24 hours). If there are no cached statistics or statistics have expired, statistics are retrieved from storage engines when querying table statistics columns. To update cached values at any time for a given table, use ANALYZE TABLE. To always retrieve the latest statistics directly from storage engines, set information_schema_stats_expiry to 0. For more information, see Section 8.2.3, “Optimizing INFORMATION_SCHEMA Queries”.

Note

If the innodb_read_only system variable is enabled, ANALYZE TABLE may fail because it cannot update statistics tables in the data dictionary, which use InnoDB. For ANALYZE TABLE operations that update the key distribution, failure may occur even if the operation updates the table itself (for example, if it is a MyISAM table). To obtain the updated distribution statistics, set information_schema_stats_expiry=0.

INFORMATION_SCHEMA Name SHOW Name Remarks
TABLE_CATALOG def
TABLE_SCHEMA = Database
TABLE_NAME Table
NON_UNIQUE Non_unique
INDEX_SCHEMA = Database
INDEX_NAME Key_name
SEQ_IN_INDEX Seq_in_index
COLUMN_NAME Column_name
COLLATION Collation
CARDINALITY Cardinality
SUB_PART Sub_part MySQL extension
PACKED Packed MySQL extension
NULLABLE Null MySQL extension
INDEX_TYPE Index_type MySQL extension
COMMENT Comment MySQL extension
INDEX_COMMENT Index_comment MySQL extension
IS_VISIBLE Visible MySQL extension

Notes:

  • There is no standard table for indexes. The preceding list is similar to what SQL Server 2000 returns for sp_statistics, except that we replaced the name QUALIFIER with CATALOG and we replaced the name OWNER with SCHEMA.

    Clearly, the preceding table and the output from SHOW INDEX are derived from the same parent. So the correlation is already close.

The following statements are equivalent:

SELECT * FROM INFORMATION_SCHEMA.STATISTICS
  WHERE table_name = 'tbl_name'
  AND table_schema = 'db_name'

SHOW INDEX
  FROM tbl_name
  FROM db_name

24.24 The INFORMATION_SCHEMA ST_GEOMETRY_COLUMNS Table

The ST_GEOMETRY_COLUMNS table provides information about table columns that store spatial data. This table is based on the SQL/MM (ISO/IEC 13249-3) standard, with extensions as noted. MySQL implements ST_GEOMETRY_COLUMNS as a view on the INFORMATION_SCHEMA COLUMNS table.

ST_GEOMETRY_COLUMNS has these columns:

  • TABLE_CATALOG

    The COLUMNS.TABLE_CATALOG value.

  • TABLE_SCHEMA

    The COLUMNS.TABLE_SCHEMA value.

  • TABLE_NAME

    The COLUMNS.TABLE_NAME value.

  • COLUMN_NAME

    The COLUMNS.TABLE_COLUMN_NAME value.

  • SRS_NAME

    The spatial reference system (SRS) name.

  • SRS_ID

    The spatial reference system ID (SRID).

  • GEOMETRY_TYPE_NAME

    The column data type. Permitted values are: geometry, point, linestring, polygon, multipoint, multilinestring, multipolygon, geometrycollection. This column is a MySQL extension to the standard.

24.25 The INFORMATION_SCHEMA ST_SPATIAL_REFERENCE_SYSTEMS Table

The ST_SPATIAL_REFERENCE_SYSTEMS table provides information about available spatial reference systems for spatial data. This table is based on the SQL/MM (ISO/IEC 13249-3) standard. MySQL implements ST_SPATIAL_REFERENCE_SYSTEMS as a view on the st_spatial_reference_systems data dictionary table.

ST_SPATIAL_REFERENCE_SYSTEMS has these columns:

  • SRS_NAME

    The spatial reference system name. This value is unique.

  • SRS_ID

    The spatial reference system numeric ID. This value is unique.

    SRS_ID values represent the same kind of values passed as the SRID argument to spatial functions.

  • ORGANIZATION

    The name of the organization that defined the coordinate system on which the spatial reference system is based.

  • ORGANIZATION_COORDSYS_ID

    The numeric ID given to the spatial reference system by the organization that defined it.

  • DEFINITION

    The spatial reference system definition, as a WKT value.

  • DESCRIPTION

    The spatial reference system description.

Notes:

  • The SRS_NAME, ORGANIZATION, ORGANIZATION_COORDSYS_ID, and DESCRIPTION columns contain information that may be of interest to users, but they are not used by MySQL.

Example:

mysql> SELECT * FROM ST_SPATIAL_REFERENCE_SYSTEMS
       WHERE SRS_ID = 4326\G
*************************** 1. row ***************************
                SRS_NAME: WGS 84
                  SRS_ID: 4326
            ORGANIZATION: EPSG
ORGANIZATION_COORDSYS_ID: 4326
              DEFINITION: GEOGCS["WGS 84",DATUM["World Geodetic System 1984",
                          SPHEROID["WGS 84",6378137,298.257223563,
                          AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],
                          PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],
                          UNIT["degree",0.017453292519943278,
                          AUTHORITY["EPSG","9122"]],
                          AXIS["Lat",NORTH],AXIS["Long",EAST],
                          AUTHORITY["EPSG","4326"]]
             DESCRIPTION: 

24.26 The INFORMATION_SCHEMA TABLES Table

The TABLES table provides information about tables in databases.

Columns in TABLES that represent table statistics hold cached values. The information_schema_stats_expiry system variable defines the period of time before cached table statistics expire. The default is 86400 seconds (24 hours). If there are no cached statistics or statistics have expired, statistics are retrieved from storage engines when querying table statistics columns. To update cached values at any time for a given table, use ANALYZE TABLE. To always retrieve the latest statistics directly from storage engines, set information_schema_stats_expiry to 0. For more information, see Section 8.2.3, “Optimizing INFORMATION_SCHEMA Queries”.

Note

If the innodb_read_only system variable is enabled, ANALYZE TABLE may fail because it cannot update statistics tables in the data dictionary, which use InnoDB. For ANALYZE TABLE operations that update the key distribution, failure may occur even if the operation updates the table itself (for example, if it is a MyISAM table). To obtain the updated distribution statistics, set information_schema_stats_expiry=0.

INFORMATION_SCHEMA Name SHOW Name Remarks
TABLE_CATALOG def
TABLE_SCHEMA Table_...
TABLE_NAME Table_...
TABLE_TYPE
ENGINE Engine MySQL extension
VERSION Version The .frm file version. With the removal of .frm files in MySQL 8.0, this field now reports a hardcoded value of 10, which is the last .frm file version used in MySQL 5.7.
ROW_FORMAT Row_format MySQL extension
TABLE_ROWS Rows MySQL extension
AVG_ROW_LENGTH Avg_row_length MySQL extension
DATA_LENGTH Data_length MySQL extension
MAX_DATA_LENGTH Max_data_length MySQL extension
INDEX_LENGTH Index_length MySQL extension
DATA_FREE Data_free MySQL extension
AUTO_INCREMENT Auto_increment MySQL extension
CREATE_TIME Create_time MySQL extension
UPDATE_TIME Update_time MySQL extension
CHECK_TIME Check_time MySQL extension
TABLE_COLLATION Collation MySQL extension
CHECKSUM Checksum MySQL extension
CREATE_OPTIONS Create_options MySQL extension
TABLE_COMMENT Comment MySQL extension

Notes:

  • Refer to SHOW TABLE STATUS for field descriptions.

  • TABLE_SCHEMA and TABLE_NAME are a single field in a SHOW display, for example Table_in_db1.

  • TABLE_TYPE should be BASE TABLE or VIEW. The TABLES table does not list TEMPORARY tables.

  • For partitioned tables, the ENGINE column shows the name of the storage engine used by all partitions. (Previously, this column showed PARTITION for such tables.)

  • The TABLE_ROWS column is NULL if the table is in the INFORMATION_SCHEMA database.

    For InnoDB tables, the row count is only a rough estimate used in SQL optimization. (This is also true if the InnoDB table is partitioned.)

  • The DATA_FREE column shows the free space in bytes for InnoDB tables.

  • UPDATE_TIME displays a timestamp value for the last UPDATE, INSERT, or DELETE performed on InnoDB tables that are not partitioned. For MVCC, the timestamp value reflects the COMMIT time, which is considered the last update time. Timestamps are not persisted when the server is restarted or when the table is evicted from the InnoDB data dictionary cache.

  • For partitioned InnoDB tables, the CHECK_TIME column is always NULL.

  • We have nothing for the table's default character set. TABLE_COLLATION is close, because collation names begin with a character set name.

  • The CREATE_OPTIONS column shows partitioned if the table is partitioned.

The following statements are equivalent:

SELECT table_name FROM INFORMATION_SCHEMA.TABLES
  WHERE table_schema = 'db_name'
  [AND table_name LIKE 'wild']

SHOW TABLES
  FROM db_name
  [LIKE 'wild']

24.27 The INFORMATION_SCHEMA TABLESPACES Table

The TABLESPACES table provides information about active tablespaces.

INFORMATION_SCHEMA Name SHOW Name Remarks
TABLESPACE_NAME MySQL extension
ENGINE MySQL extension
TABLESPACE_TYPE MySQL extension
LOGFILE_GROUP_NAME MySQL extension
EXTENT_SIZE MySQL extension
AUTOEXTEND_SIZE MySQL extension
MAXIMUM_SIZE MySQL extension
NODEGROUP_ID MySQL extension
TABLESPACE_COMMENT MySQL extension

Notes:

The INFORMATION_SCHEMA.TABLESPACES table does not provide information about InnoDB tablespaces. For InnoDB tablespace metadata, see INNODB_TABLESPACES and INNODB_DATAFILES. The INFORMATION_SCHEMA.FILES table also provides metadata for InnoDB tablespaces.

24.28 The INFORMATION_SCHEMA TABLE_CONSTRAINTS Table

The TABLE_CONSTRAINTS table describes which tables have constraints.

INFORMATION_SCHEMA Name SHOW Name Remarks
CONSTRAINT_CATALOG def
CONSTRAINT_SCHEMA
CONSTRAINT_NAME
TABLE_SCHEMA
TABLE_NAME
CONSTRAINT_TYPE

Notes:

  • The CONSTRAINT_TYPE value can be UNIQUE, PRIMARY KEY, or FOREIGN KEY.

  • The UNIQUE and PRIMARY KEY information is about the same as what you get from the Key_name field in the output from SHOW INDEX when the Non_unique field is 0.

  • The CONSTRAINT_TYPE column can contain one of these values: UNIQUE, PRIMARY KEY, FOREIGN KEY, CHECK. This is a CHAR (not ENUM) column. The CHECK value is not available until we support CHECK.

24.29 The INFORMATION_SCHEMA TABLE_PRIVILEGES Table

The TABLE_PRIVILEGES table provides information about table privileges. This information comes from the mysql.tables_priv grant table.

INFORMATION_SCHEMA Name SHOW Name Remarks
GRANTEE 'user_name'@'host_name' value
TABLE_CATALOG def
TABLE_SCHEMA
TABLE_NAME
PRIVILEGE_TYPE
IS_GRANTABLE

Notes:

The following statements are not equivalent:

SELECT ... FROM INFORMATION_SCHEMA.TABLE_PRIVILEGES

SHOW GRANTS ...

24.30 The INFORMATION_SCHEMA TRIGGERS Table

The TRIGGERS table provides information about triggers. To see information about a table's triggers, you must have the TRIGGER privilege for the table.

INFORMATION_SCHEMA Name SHOW Name Remarks
TRIGGER_CATALOG def
TRIGGER_SCHEMA
TRIGGER_NAME Trigger
EVENT_MANIPULATION Event
EVENT_OBJECT_CATALOG def
EVENT_OBJECT_SCHEMA
EVENT_OBJECT_TABLE Table
ACTION_ORDER
ACTION_CONDITION NULL
ACTION_STATEMENT Statement
ACTION_ORIENTATION ROW
ACTION_TIMING Timing
ACTION_REFERENCE_OLD_TABLE NULL
ACTION_REFERENCE_NEW_TABLE NULL
ACTION_REFERENCE_OLD_ROW OLD
ACTION_REFERENCE_NEW_ROW NEW
CREATED Created
SQL_MODE sql_mode MySQL extension
DEFINER Definer MySQL extension
CHARACTER_SET_CLIENT character_set_client MySQL extension
COLLATION_CONNECTION collation_connection MySQL extension
DATABASE_COLLATION Database Collation MySQL extension

Notes:

  • The names in the SHOW Name column refer to the SHOW TRIGGERS statement, not SHOW CREATE TRIGGER. See Section 13.7.6.38, “SHOW TRIGGERS Syntax”.

  • TRIGGER_SCHEMA and TRIGGER_NAME: The name of the database in which the trigger occurs and the trigger name, respectively.

  • EVENT_MANIPULATION: The trigger event. This is the type of operation on the associated table for which the trigger activates. The value is 'INSERT' (a row was inserted), 'DELETE' (a row was deleted), or 'UPDATE' (a row was modified).

  • EVENT_OBJECT_SCHEMA and EVENT_OBJECT_TABLE: As noted in Section 23.3, “Using Triggers”, every trigger is associated with exactly one table. These columns indicate the database in which this table occurs, and the table name, respectively.

  • ACTION_ORDER: The ordinal position of the trigger's action within the list of triggers on the same table with the same EVENT_MANIPULATION and ACTION_TIMING values.

  • ACTION_STATEMENT: The trigger body; that is, the statement executed when the trigger activates. This text uses UTF-8 encoding.

  • ACTION_ORIENTATION: Always contains the value 'ROW'.

  • ACTION_TIMING: Whether the trigger activates before or after the triggering event. The value is 'BEFORE' or 'AFTER'.

  • ACTION_REFERENCE_OLD_ROW and ACTION_REFERENCE_NEW_ROW: The old and new column identifiers, respectively. This means that ACTION_REFERENCE_OLD_ROW always contains the value 'OLD' and ACTION_REFERENCE_NEW_ROW always contains the value 'NEW'.

  • CREATED: The date and time when the trigger was created. This is a TIMESTAMP(2) value (with a fractional part in hundredths of seconds) for triggers.

  • SQL_MODE: The SQL mode in effect when the trigger was created, and under which the trigger executes. For the permitted values, see Section 5.1.10, “Server SQL Modes”.

  • DEFINER: The account of the user who created the trigger, in 'user_name'@'host_name' format.

  • CHARACTER_SET_CLIENT: The session value of the character_set_client system variable when the trigger was created.

  • COLLATION_CONNECTION: The session value of the collation_connection system variable when the trigger was created.

  • DATABASE_COLLATION: The collation of the database with which the trigger is associated.

  • The following columns currently always contain NULL: ACTION_CONDITION, ACTION_REFERENCE_OLD_TABLE, and ACTION_REFERENCE_NEW_TABLE.

Example, using the ins_sum trigger defined in Section 23.3, “Using Triggers”:

mysql> SELECT * FROM INFORMATION_SCHEMA.TRIGGERS
       WHERE TRIGGER_SCHEMA='test' AND TRIGGER_NAME='ins_sum'\G
*************************** 1. row ***************************
           TRIGGER_CATALOG: def
            TRIGGER_SCHEMA: test
              TRIGGER_NAME: ins_sum
        EVENT_MANIPULATION: INSERT
      EVENT_OBJECT_CATALOG: def
       EVENT_OBJECT_SCHEMA: test
        EVENT_OBJECT_TABLE: account
              ACTION_ORDER: 1
          ACTION_CONDITION: NULL
          ACTION_STATEMENT: SET @sum = @sum + NEW.amount
        ACTION_ORIENTATION: ROW
             ACTION_TIMING: BEFORE
ACTION_REFERENCE_OLD_TABLE: NULL
ACTION_REFERENCE_NEW_TABLE: NULL
  ACTION_REFERENCE_OLD_ROW: OLD
  ACTION_REFERENCE_NEW_ROW: NEW
                   CREATED: 2017-03-30 20:29:39.06
                  SQL_MODE: ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
                   DEFINER: me@localhost
      CHARACTER_SET_CLIENT: utf8
      COLLATION_CONNECTION: utf8_general_ci
        DATABASE_COLLATION: utf8mb4_0900_ai_ci

24.31 The INFORMATION_SCHEMA USER_PRIVILEGES Table

The USER_PRIVILEGES table provides information about global privileges. This information comes from the mysql.user grant table.

INFORMATION_SCHEMA Name SHOW Name Remarks
GRANTEE 'user_name'@'host_name' value, MySQL extension
TABLE_CATALOG def, MySQL extension
PRIVILEGE_TYPE MySQL extension
IS_GRANTABLE MySQL extension

Notes:

  • This is a nonstandard table. It takes its values from the mysql.user table.

24.32 The INFORMATION_SCHEMA VIEWS Table

The VIEWS table provides information about views in databases. You must have the SHOW VIEW privilege to access this table.

INFORMATION_SCHEMA Name SHOW Name Remarks
TABLE_CATALOG def
TABLE_SCHEMA
TABLE_NAME
VIEW_DEFINITION
CHECK_OPTION
IS_UPDATABLE
DEFINER
SECURITY_TYPE
CHARACTER_SET_CLIENT MySQL extension
COLLATION_CONNECTION MySQL extension

Notes:

  • The VIEW_DEFINITION column has most of what you see in the Create Table field that SHOW CREATE VIEW produces. Skip the words before SELECT and skip the words WITH CHECK OPTION. Suppose that the original statement was:

    CREATE VIEW v AS
      SELECT s2,s1 FROM t
      WHERE s1 > 5
      ORDER BY s1
      WITH CHECK OPTION;
    

    Then the view definition looks like this:

    SELECT s2,s1 FROM t WHERE s1 > 5 ORDER BY s1
    
  • The CHECK_OPTION column has a value of NONE, CASCADE, or LOCAL.

  • MySQL sets a flag, called the view updatability flag, at CREATE VIEW time. The flag is set to YES (true) if UPDATE and DELETE (and similar operations) are legal for the view. Otherwise, the flag is set to NO (false). The IS_UPDATABLE column in the VIEWS table displays the status of this flag. It means that the server always knows whether a view is updatable.

    If a view is not updatable, statements such UPDATE, DELETE, and INSERT are illegal and will be rejected. (Note that even if a view is updatable, it might not be possible to insert into it; for details, refer to Section 23.5.3, “Updatable and Insertable Views”.)

  • DEFINER: The account of the user who created the view, in 'user_name'@'host_name' format. SECURITY_TYPE has a value of DEFINER or INVOKER.

  • CHARACTER_SET_CLIENT: The session value of the character_set_client system variable when the view was created.

  • COLLATION_CONNECTION: The session value of the collation_connection system variable when the view was created.

MySQL lets you use different sql_mode settings to tell the server the type of SQL syntax to support. For example, you might use the ANSI SQL mode to ensure MySQL correctly interprets the standard SQL concatenation operator, the double bar (||), in your queries. If you then create a view that concatenates items, you might worry that changing the sql_mode setting to a value different from ANSI could cause the view to become invalid. But this is not the case. No matter how you write out a view definition, MySQL always stores it the same way, in a canonical form. Here is an example that shows how the server changes a double bar concatenation operator to a CONCAT() function:

mysql> SET sql_mode = 'ANSI';
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE VIEW test.v AS SELECT 'a' || 'b' as col1;
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS
       WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'v';
+----------------------------------+
| VIEW_DEFINITION                  |
+----------------------------------+
| select concat('a','b') AS `col1` |
+----------------------------------+
1 row in set (0.00 sec)

The advantage of storing a view definition in canonical form is that changes made later to the value of sql_mode will not affect the results from the view. However an additional consequence is that comments prior to SELECT are stripped from the definition by the server.

24.33 InnoDB INFORMATION_SCHEMA Tables

24.33.1 The INFORMATION_SCHEMA INNODB_BUFFER_PAGE Table
24.33.2 The INFORMATION_SCHEMA INNODB_BUFFER_PAGE_LRU Table
24.33.3 The INFORMATION_SCHEMA INNODB_BUFFER_POOL_STATS Table
24.33.4 The INFORMATION_SCHEMA INNODB_CACHED_INDEXES Table
24.33.5 The INFORMATION_SCHEMA INNODB_CMP and INNODB_CMP_RESET Tables
24.33.6 The INFORMATION_SCHEMA INNODB_CMPMEM and INNODB_CMPMEM_RESET Tables
24.33.7 The INFORMATION_SCHEMA INNODB_CMP_PER_INDEX and INNODB_CMP_PER_INDEX_RESET Tables
24.33.8 The INFORMATION_SCHEMA INNODB_FT_BEING_DELETED Table
24.33.9 The INFORMATION_SCHEMA INNODB_FT_CONFIG Table
24.33.10 The INFORMATION_SCHEMA INNODB_FT_DEFAULT_STOPWORD Table
24.33.11 The INFORMATION_SCHEMA INNODB_FT_DELETED Table
24.33.12 The INFORMATION_SCHEMA INNODB_FT_INDEX_CACHE Table
24.33.13 The INFORMATION_SCHEMA INNODB_FT_INDEX_TABLE Table
24.33.14 The INFORMATION_SCHEMA INNODB_LOCKS Table
24.33.15 The INFORMATION_SCHEMA INNODB_LOCK_WAITS Table
24.33.16 The INFORMATION_SCHEMA INNODB_METRICS Table
24.33.17 The INFORMATION_SCHEMA INNODB_COLUMNS Table
24.33.18 The INFORMATION_SCHEMA INNODB_DATAFILES Table
24.33.19 The INFORMATION_SCHEMA INNODB_FIELDS Table
24.33.20 The INFORMATION_SCHEMA INNODB_FOREIGN Table
24.33.21 The INFORMATION_SCHEMA INNODB_FOREIGN_COLS Table
24.33.22 The INFORMATION_SCHEMA INNODB_INDEXES Table
24.33.23 The INFORMATION_SCHEMA INNODB_TABLES Table
24.33.24 The INFORMATION_SCHEMA INNODB_TABLESPACES Table
24.33.25 The INFORMATION_SCHEMA INNODB_TABLESPACES_BRIEF Table
24.33.26 The INFORMATION_SCHEMA INNODB_TABLESTATS View
24.33.27 The INFORMATION_SCHEMA INNODB_VIRTUAL Table
24.33.28 The INFORMATION_SCHEMA INNODB_TEMP_TABLE_INFO Table
24.33.29 The INFORMATION_SCHEMA INNODB_TRX Table

This section provides table definitions for InnoDB INFORMATION_SCHEMA tables. For related information and examples, see Section 15.14, “InnoDB INFORMATION_SCHEMA Tables”.

InnoDB INFORMATION_SCHEMA tables can be used to monitor ongoing InnoDB activity, to detect inefficiencies before they turn into issues, or to troubleshoot performance and capacity issues. As your database becomes bigger and busier, running up against the limits of your hardware capacity, you monitor and tune these aspects to keep the database running smoothly.

24.33.1 The INFORMATION_SCHEMA INNODB_BUFFER_PAGE Table

The INNODB_BUFFER_PAGE table holds information about each page in the InnoDB buffer pool.

For related usage information and examples, see Section 15.14.5, “InnoDB INFORMATION_SCHEMA Buffer Pool Tables”.

Warning

Querying the INNODB_BUFFER_PAGE table can introduce significant performance overhead. Do not query this table on a production system unless you are aware of the performance impact that your query may have, and have determined it to be acceptable. To avoid impacting performance, reproduce the issue you want to investigate on a test instance and query the INNODB_BUFFER_PAGE table on the test instance.

Table 24.1 INNODB_BUFFER_PAGE Columns

Column name Description
POOL_ID Buffer Pool ID. An identifier to distinguish between multiple buffer pool instances.
BLOCK_ID Buffer Pool Block ID.
SPACE Tablespace ID. Uses the same value as in INNODB_TABLES.SPACE.
PAGE_NUMBER Page number.
PAGE_TYPE Page type. Permitted values are: ALLOCATED (Freshly allocated page), INDEX (B-tree node), UNDO_LOG (Undo log page), INODE (Index node), IBUF_FREE_LIST (Insert buffer free list), IBUF_BITMAP (Insert buffer bitmap), SYSTEM (System page), TRX_SYSTEM (Transaction system data), FILE_SPACE_HEADER (File space header), EXTENT_DESCRIPTOR (Extent descriptor page), BLOB (Uncompressed BLOB page), COMPRESSED_BLOB (First compressed BLOB page), COMPRESSED_BLOB2 (Subsequent comp BLOB page), IBUF_INDEX (Insert buffer index), RTREE_INDEX (R-tree index), SDI_INDEX (SDI index), SDI_BLOB (Uncompressed SDI BLOB), SDI_COMPRESSED_BLOB (Compressed SDI BLOB), UNKNOWN (Unknown), PAGE_IO_COMPRESSED (Compressed page), PAGE_IO_ENCRYPTED (Encrypted page), PAGE_IO_COMPRESSED_ENCRYPTED (Compressed and encrypted page), ENCRYPTED_RTREE (Encrypted R-tree), FIL_PAGE_TYPE_UNUSED (Unused), RSEG_ARRAY (Rollback segment array), LOB INDEX (Uncompressed LOB index), LOB_DATA (Uncompressed LOB data), LOB_FIRST (First page of uncompressed LOB), ZLOB_FIRST (First page of compressed LOB), ZLOB_DATA (Compressed LOB data), ZLOB_INDEX (Compressed LOB index), ZLOB_FRAG (Compressed LOB fragment), ZLOB_FRAG_ENTRY (Compressed LOB fragment index).
FLUSH_TYPE Flush type.
FIX_COUNT Number of threads using this block within the buffer pool. When zero, the block is eligible to be evicted.
IS_HASHED Whether hash index has been built on this page.
NEWEST_MODIFICATION Log Sequence Number of the youngest modification.
OLDEST_MODIFICATION Log Sequence Number of the oldest modification.
ACCESS_TIME An abstract number used to judge the first access time of the page.
TABLE_NAME Name of the table the page belongs to. This column is only applicable to pages of type INDEX.
INDEX_NAME Name of the index the page belongs to. It can be the name of a clustered index or a secondary index. This column is only applicable to pages of type INDEX.
NUMBER_RECORDS Number of records within the page.
DATA_SIZE Sum of the sizes of the records. This column is only applicable to pages of type INDEX.
COMPRESSED_SIZE Compressed page size. Null for pages that are not compressed.
PAGE_STATE Page state. Possible values include: NULL (clean compressed pages, compressed pages in the flush list, pages used as buffer pool watch sentinels), NOT_USED (in the free list), READY_FOR_USE (a free page), FILE_PAGE (a buffered file page), MEMORY (contains a main memory object), REMOVE_HASH (hash index should be removed before placing in the free list).
IO_FIX Specifies whether any I/O is pending for this page: IO_NONE = no pending I/O, IO_READ = read pending, IO_WRITE = write pending.
IS_OLD Specifies whether or not the block is in the sublist of old blocks in the LRU list.
FREE_PAGE_CLOCK The value of the freed_page_clock counter when the block was the last placed at the head of the LRU list. The freed_page_clock counter tracks the number of blocks removed from the end of the LRU list.

Example:

mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE LIMIT 1\G
*************************** 1. row ***************************
            POOL_ID: 0
           BLOCK_ID: 0
              SPACE: 97
        PAGE_NUMBER: 2473
          PAGE_TYPE: INDEX
         FLUSH_TYPE: 1
          FIX_COUNT: 0
          IS_HASHED: YES
NEWEST_MODIFICATION: 733855581
OLDEST_MODIFICATION: 0
        ACCESS_TIME: 3378385672
         TABLE_NAME: `employees`.`salaries`
         INDEX_NAME: PRIMARY
     NUMBER_RECORDS: 468
          DATA_SIZE: 14976
    COMPRESSED_SIZE: 0
         PAGE_STATE: FILE_PAGE
             IO_FIX: IO_NONE
             IS_OLD: YES
    FREE_PAGE_CLOCK: 66

Notes:

  • This table is primarily useful for expert-level performance monitoring, or when developing performance-related extensions for MySQL.

  • Use DESCRIBE or SHOW COLUMNS to view additional information about the columns of this table including data types and default values.

  • You must have the PROCESS privilege to query this table.

  • When tables, table rows, partitions, or indexes are deleted, associated pages remain in the buffer pool until space is required for other data. The INNODB_BUFFER_PAGE table reports information about these pages until they are evicted from the buffer pool. For more information about how the InnoDB manages buffer pool data, see Section 15.6.3.1, “The InnoDB Buffer Pool”.

24.33.2 The INFORMATION_SCHEMA INNODB_BUFFER_PAGE_LRU Table

The INNODB_BUFFER_PAGE_LRU table holds information about the pages in the InnoDB buffer pool, in particular how they are ordered in the LRU list that determines which pages to evict from the buffer pool when it becomes full.

The INNODB_BUFFER_PAGE_LRU table has the same columns as the INNODB_BUFFER_PAGE table, except that the INNODB_BUFFER_PAGE_LRU table has an LRU_POSITION column instead of a BLOCK_ID column.

For related usage information and examples, see Section 15.14.5, “InnoDB INFORMATION_SCHEMA Buffer Pool Tables”.

Warning

Querying the INNODB_BUFFER_PAGE_LRU table can introduce significant performance overhead. Do not query this table on a production system unless you are aware of the performance impact that your query may have, and have determined it to be acceptable. To avoid impacting performance, reproduce the issue you want to investigate on a test instance and query the INNODB_BUFFER_PAGE_LRU table on the test instance.

Table 24.2 INNODB_BUFFER_PAGE_LRU Columns

Column name Description
POOL_ID Buffer Pool ID. An identifier to distinguish between multiple buffer pool instances.
LRU_POSITION The position of the page in the LRU list.
SPACE Tablespace ID. Uses the same value as in INNODB_TABLES.SPACE.
PAGE_NUMBER Page number.
PAGE_TYPE Page type. Permitted values are: ALLOCATED (Freshly allocated page), INDEX (B-tree node), UNDO_LOG (Undo log page), INODE (Index node), IBUF_FREE_LIST (Insert buffer free list), IBUF_BITMAP (Insert buffer bitmap), SYSTEM (System page), TRX_SYSTEM (Transaction system data), FILE_SPACE_HEADER (File space header), EXTENT_DESCRIPTOR (Extent descriptor page), BLOB (Uncompressed BLOB page), COMPRESSED_BLOB (First compressed BLOB page), COMPRESSED_BLOB2 (Subsequent comp BLOB page), IBUF_INDEX (Insert buffer index), RTREE_INDEX (R-tree index), SDI_INDEX (SDI index), SDI_BLOB (Uncompressed SDI BLOB), SDI_COMPRESSED_BLOB (Compressed SDI BLOB), UNKNOWN (Unknown), PAGE_IO_COMPRESSED (Compressed page), PAGE_IO_ENCRYPTED (Encrypted page), PAGE_IO_COMPRESSED_ENCRYPTED (Compressed and encrypted page), ENCRYPTED_RTREE (Encrypted R-tree), FIL_PAGE_TYPE_UNUSED (Unused), RSEG_ARRAY (Rollback segment array), LOB INDEX (Uncompressed LOB index), LOB_DATA (Uncompressed LOB data), LOB_FIRST (First page of uncompressed LOB), ZLOB_FIRST (First page of compressed LOB), ZLOB_DATA (Compressed LOB data), ZLOB_INDEX (Compressed LOB index), ZLOB_FRAG (Compressed LOB fragment), ZLOB_FRAG_ENTRY (Compressed LOB fragment index).
FLUSH_TYPE Flush type.
FIX_COUNT Number of threads using this block within the buffer pool. When zero, the block is eligible to be evicted.
IS_HASHED Whether hash index has been built on this page.
NEWEST_MODIFICATION Log Sequence Number of the youngest modification.
OLDEST_MODIFICATION Log Sequence Number of the oldest modification.
ACCESS_TIME An abstract number used to judge the first access time of the page.
TABLE_NAME Name of the table the page belongs to. This column is only applicable to pages of type INDEX.
INDEX_NAME Name of the index the page belongs to. It can be the name of a clustered index or a secondary index. This column is only applicable to pages of type INDEX.
NUMBER_RECORDS Number of records within the page.
DATA_SIZE Sum of the sizes of the records. This column is only applicable to pages of type INDEX.
COMPRESSED_SIZE Compressed page size. Null for pages that are not compressed.
PAGE_STATE Page state. Possible values include: NULL (clean compressed pages, compressed pages in the flush list, pages used as buffer pool watch sentinels), NOT_USED (in the free list), READY_FOR_USE (a free page), FILE_PAGE (a buffered file page), MEMORY (contains a main memory object), REMOVE_HASH (hash index should be removed before placing in the free list).
IO_FIX Specifies whether any I/O is pending for this page: IO_NONE = no pending I/O, IO_READ = read pending, IO_WRITE = write pending.
IS_OLD Specifies whether or not the block is in the sublist of old blocks in the LRU list.
FREE_PAGE_CLOCK The value of the freed_page_clock counter when the block was the last placed at the head of the LRU list. The freed_page_clock counter tracks the number of blocks removed from the end of the LRU list.

Example

mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE_LRU LIMIT 1\G
*************************** 1. row ***************************
            POOL_ID: 0
       LRU_POSITION: 0
              SPACE: 97
        PAGE_NUMBER: 1984
          PAGE_TYPE: INDEX
         FLUSH_TYPE: 1
          FIX_COUNT: 0
          IS_HASHED: YES
NEWEST_MODIFICATION: 719490396
OLDEST_MODIFICATION: 0
        ACCESS_TIME: 3378383796
         TABLE_NAME: `employees`.`salaries`
         INDEX_NAME: PRIMARY
     NUMBER_RECORDS: 468
          DATA_SIZE: 14976
    COMPRESSED_SIZE: 0
         COMPRESSED: NO
             IO_FIX: IO_NONE
             IS_OLD: YES
    FREE_PAGE_CLOCK: 0

Notes

  • This table is primarily useful for expert-level performance monitoring, or when developing performance-related extensions for MySQL.

  • You must have the PROCESS privilege to query this table.

  • Use DESCRIBE or SHOW COLUMNS to view additional information about the columns of this table including data types and default values.

  • Querying this table can require MySQL to allocate a large block of contiguous memory, more than 64 bytes time the number of active pages in the buffer pool. This allocation could potentially cause an out-of-memory error, especially for systems with multi-gigabyte buffer pools.

  • Querying this table requires MySQL to lock the data structure representing the buffer pool while traversing the LRU list, which can reduce concurrency, especially for systems with multi-gigabyte buffer pools.

  • When tables, table rows, partitions, or indexes are deleted, associated pages remain in the buffer pool until space is required for other data. The INNODB_BUFFER_PAGE_LRU table reports information about these pages until they are evicted from the buffer pool. For more information about how the InnoDB manages buffer pool data, see Section 15.6.3.1, “The InnoDB Buffer Pool”.

24.33.3 The INFORMATION_SCHEMA INNODB_BUFFER_POOL_STATS Table

The INNODB_BUFFER_POOL_STATS table provides much of the same buffer pool information provided in SHOW ENGINE INNODB STATUS output. Much of the same information may also be obtained using InnoDB buffer pool server status variables.

The idea of making pages in the buffer pool young or not young refers to transferring them between the sublists at the head and tail of the buffer pool data structure. Pages made young take longer to age out of the buffer pool, while pages made not young are moved much closer to the point of eviction.

For related usage information and examples, see Section 15.14.5, “InnoDB INFORMATION_SCHEMA Buffer Pool Tables”.

Table 24.3 INNODB_BUFFER_POOL_STATS Columns

Column name Description
POOL_ID Buffer Pool ID. A unique identifier to distinguish between multiple buffer pool instances.
POOL_SIZE The InnoDB buffer pool size in pages.
FREE_BUFFERS The number of free pages in the InnoDB buffer pool
DATABASE_PAGES The number of pages in the InnoDB buffer pool containing data. The number includes both dirty and clean pages.
OLD_DATABASE_PAGES The number of pages in the old buffer pool sublist.
MODIFIED_DATABASE_PAGES The number of modified (dirty) database pages
PENDING_DECOMPRESS The number of pages pending decompression
PENDING_READS The number of pending reads
PENDING_FLUSH_LRU The number of pages pending flush in the LRU
PENDING_FLUSH_LIST The number of pages pending flush in the flush list
PAGES_MADE_YOUNG The number of pages made young
PAGES_NOT_MADE_YOUNG The number of pages not made young
PAGES_MADE_YOUNG_RATE The number of pages made young per second (pages made young since the last printout / time elapsed)
PAGES_MADE_NOT_YOUNG_RATE The number of pages not made per second (pages not made young since the last printout / time elapsed)
NUMBER_PAGES_READ The number of pages read
NUMBER_PAGES_CREATED The number of pages created
NUMBER_PAGES_WRITTEN The number of pages written
PAGES_READ_RATE The number of pages read per second (pages read since the last printout / time elapsed)
PAGES_CREATE_RATE The number of pages created per second (pages created since the last printout / time elapsed)
PAGES_WRITTEN_RATE The number of pages written per second (pages written since the last printout / time elapsed)
NUMBER_PAGES_GET The number of logical read requests.
HIT_RATE The buffer pool hit rate
YOUNG_MAKE_PER_THOUSAND_GETS The number of pages made young per thousand gets
NOT_YOUNG_MAKE_PER_THOUSAND_GETS The number of pages not made young per thousand gets
NUMBER_PAGES_READ_AHEAD The number of pages read ahead
NUMBER_READ_AHEAD_EVICTED The number of pages read into the InnoDB buffer pool by the read-ahead background thread that were subsequently evicted without having been accessed by queries.
READ_AHEAD_RATE The read ahead rate per second (pages read ahead since the last printout / time elapsed)
READ_AHEAD_EVICTED_RATE The number of read ahead pages evicted without access per second (read ahead pages not accessed since the last printout / time elapsed)
LRU_IO_TOTAL LRU IO total
LRU_IO_CURRENT LRU IO for the current interval
UNCOMPRESS_TOTAL Total number of pages decompressed
UNCOMPRESS_CURRENT The number of pages decompressed in the current interval

Example:

mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_POOL_STATS\G
*************************** 1. row ***************************
                         POOL_ID: 0
                       POOL_SIZE: 8192
                    FREE_BUFFERS: 1
                  DATABASE_PAGES: 8085
              OLD_DATABASE_PAGES: 2964
         MODIFIED_DATABASE_PAGES: 0
              PENDING_DECOMPRESS: 0
                   PENDING_READS: 0
               PENDING_FLUSH_LRU: 0
              PENDING_FLUSH_LIST: 0
                PAGES_MADE_YOUNG: 22821
            PAGES_NOT_MADE_YOUNG: 3544303
           PAGES_MADE_YOUNG_RATE: 357.62602199870594
       PAGES_MADE_NOT_YOUNG_RATE: 0
               NUMBER_PAGES_READ: 2389
            NUMBER_PAGES_CREATED: 12385
            NUMBER_PAGES_WRITTEN: 13111
                 PAGES_READ_RATE: 0
               PAGES_CREATE_RATE: 0
              PAGES_WRITTEN_RATE: 0
                NUMBER_PAGES_GET: 33322210
                        HIT_RATE: 1000
    YOUNG_MAKE_PER_THOUSAND_GETS: 18
NOT_YOUNG_MAKE_PER_THOUSAND_GETS: 0
         NUMBER_PAGES_READ_AHEAD: 2024
       NUMBER_READ_AHEAD_EVICTED: 0
                 READ_AHEAD_RATE: 0
         READ_AHEAD_EVICTED_RATE: 0
                    LRU_IO_TOTAL: 0
                  LRU_IO_CURRENT: 0
                UNCOMPRESS_TOTAL: 0
              UNCOMPRESS_CURRENT: 0

Notes:

  • This table is primarily useful for expert-level performance monitoring, or when developing performance-related extensions for MySQL.

  • Use DESCRIBE or SHOW COLUMNS to view additional information about the columns of this table including data types and default values.

  • You must have the PROCESS privilege to query this table.

24.33.4 The INFORMATION_SCHEMA INNODB_CACHED_INDEXES Table

The INNODB_CACHED_INDEXES table reports the number of index pages cached in the InnoDB buffer pool for each index.

Table 24.4 INNODB_CACHED_INDEXES Columns

Column name Description
SPACE_ID Tablespace Space ID.
INDEX_ID An identifier for each index that is unique across all the databases in an instance.
N_CACHED_PAGES The number of index pages cached in the InnoDB buffer pool.

Examples:

This query returns the number of index pages cached in the InnoDB buffer pool for a specific index:

mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_CACHED_INDEXES WHERE INDEX_ID=65\G
*************************** 1. row ***************************
      INDEX_ID: 65
N_CACHED_PAGES: 45
1 row in set (0.00 sec)

This query returns the number of index pages cached in the InnoDB buffer pool for each index, and uses the INNODB_INDEXES and INNODB_TABLES to resolve the table name and index name for each INDEX_ID value.

SELECT
  tables.name AS table_name,
  indexes.name AS index_name,
  cached.n_cached_pages AS n_cached_pages
FROM
  INFORMATION_SCHEMA.INNODB_CACHED_INDEXES AS cached,
  INFORMATION_SCHEMA.INNODB_INDEXES AS indexes,
  INFORMATION_SCHEMA.INNODB_TABLES AS tables
WHERE
  cached.index_id = indexes.index_id
  AND indexes.table_id = tables.table_id;

Notes:

  • Use DESCRIBE or SHOW COLUMNS to view additional information about the columns of this table including data types and default values.

  • You must have the PROCESS privilege to query this table.

24.33.5 The INFORMATION_SCHEMA INNODB_CMP and INNODB_CMP_RESET Tables

The INNODB_CMP and INNODB_CMP_RESET tables contain status information on operations related to compressed InnoDB tables.

Table 24.5 Columns of INNODB_CMP and INNODB_CMP_RESET

Column name Description
PAGE_SIZE Compressed page size in bytes.
COMPRESS_OPS Number of times a B-tree page of the size PAGE_SIZE has been compressed. Pages are compressed whenever an empty page is created or the space for the uncompressed modification log runs out.
COMPRESS_OPS_OK Number of times a B-tree page of the size PAGE_SIZE has been successfully compressed. This count should never exceed COMPRESS_OPS.
COMPRESS_TIME Total time in seconds spent in attempts to compress B-tree pages of the size PAGE_SIZE.
UNCOMPRESS_OPS Number of times a B-tree page of the size PAGE_SIZE has been uncompressed. B-tree pages are uncompressed whenever compression fails or at first access when the uncompressed page does not exist in the buffer pool.
UNCOMPRESS_TIME Total time in seconds spent in uncompressing B-tree pages of the size PAGE_SIZE.

Example:

mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_CMP\G
*************************** 1. row ***************************
      page_size: 1024
   compress_ops: 0
compress_ops_ok: 0
  compress_time: 0
 uncompress_ops: 0
uncompress_time: 0
*************************** 2. row ***************************
      page_size: 2048
   compress_ops: 0
compress_ops_ok: 0
  compress_time: 0
 uncompress_ops: 0
uncompress_time: 0
*************************** 3. row ***************************
      page_size: 4096
   compress_ops: 0
compress_ops_ok: 0
  compress_time: 0
 uncompress_ops: 0
uncompress_time: 0
*************************** 4. row ***************************
      page_size: 8192
   compress_ops: 86955
compress_ops_ok: 81182
  compress_time: 27
 uncompress_ops: 26828
uncompress_time: 5
*************************** 5. row ***************************
      page_size: 16384
   compress_ops: 0
compress_ops_ok: 0
  compress_time: 0
 uncompress_ops: 0
uncompress_time: 0

Notes:

24.33.6 The INFORMATION_SCHEMA INNODB_CMPMEM and INNODB_CMPMEM_RESET Tables

The INNODB_CMPMEM and INNODB_CMPMEM_RESET tables contain status information on compressed pages within the InnoDB buffer pool.

Table 24.6 Columns of INNODB_CMPMEM and INNODB_CMPMEM_RESET

Column name Description
PAGE_SIZE Block size in bytes. Each record of this table describes blocks of this size.
BUFFER_POOL_INSTANCE A unique identifier for the buffer pool instance.
PAGES_USED Number of blocks of the size PAGE_SIZE that are currently in use.
PAGES_FREE Number of blocks of the size PAGE_SIZE that are currently available for allocation. This column shows the external fragmentation in the memory pool. Ideally, these numbers should be at most 1.
RELOCATION_OPS Number of times a block of the size PAGE_SIZE has been relocated. The buddy system can relocate the allocated buddy neighbor of a freed block when it tries to form a bigger freed block. Reading from the table INNODB_CMPMEM_RESET resets this count.
RELOCATION_TIME Total time in microseconds spent in relocating blocks of the size PAGE_SIZE. Reading from the table INNODB_CMPMEM_RESET resets this count.

Example:

mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_CMPMEM\G
*************************** 1. row ***************************
           page_size: 1024
buffer_pool_instance: 0
          pages_used: 0
          pages_free: 0
      relocation_ops: 0
     relocation_time: 0
*************************** 2. row ***************************
           page_size: 2048
buffer_pool_instance: 0
          pages_used: 0
          pages_free: 0
      relocation_ops: 0
     relocation_time: 0
*************************** 3. row ***************************
           page_size: 4096
buffer_pool_instance: 0
          pages_used: 0
          pages_free: 0
      relocation_ops: 0
     relocation_time: 0
*************************** 4. row ***************************
           page_size: 8192
buffer_pool_instance: 0
          pages_used: 7673
          pages_free: 15
      relocation_ops: 4638
     relocation_time: 0
*************************** 5. row ***************************
           page_size: 16384
buffer_pool_instance: 0
          pages_used: 0
          pages_free: 0
      relocation_ops: 0
     relocation_time: 0

Notes:

24.33.7 The INFORMATION_SCHEMA INNODB_CMP_PER_INDEX and INNODB_CMP_PER_INDEX_RESET Tables

The INNODB_CMP_PER_INDEX and INNODB_CMP_PER_INDEX_RESET tables contain status information on operations related to compressed InnoDB tables and indexes, with separate statistics for each combination of database, table, and index, to help you evaluate the performance and usefulness of compression for specific tables.

For a compressed InnoDB table, both the table data and all the secondary indexes are compressed. In this context, the table data is treated as just another index, one that happens to contain all the columns: the clustered index.

Table 24.7 Columns of INNODB_CMP_PER_INDEX and INNODB_CMP_PER_INDEX_RESET

Column name Description
DATABASE_NAME Database containing the applicable table.
TABLE_NAME Table to monitor for compression statistics.
INDEX_NAME Index to monitor for compression statistics.
COMPRESS_OPS Number of compression operations attempted. Pages are compressed whenever an empty page is created or the space for the uncompressed modification log runs out.
COMPRESS_OPS_OK Number of successful compression operations. Subtract from the COMPRESS_OPS value to get the number of compression failures. Divide by the COMPRESS_OPS value to get the percentage of compression failures.
COMPRESS_TIME Total amount of CPU time, in seconds, used for compressing data in this index.
UNCOMPRESS_OPS Number of uncompression operations performed. Compressed InnoDB pages are uncompressed whenever compression fails, or the first time a compressed page is accessed in the buffer pool and the uncompressed page does not exist.
UNCOMPRESS_TIME Total amount of CPU time, in seconds, used for uncompressing data in this index.

Example:

mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_CMP_PER_INDEX\G
*************************** 1. row ***************************
  database_name: employees
     table_name: salaries
     index_name: PRIMARY
   compress_ops: 0
compress_ops_ok: 0
  compress_time: 0
 uncompress_ops: 23451
uncompress_time: 4
*************************** 2. row ***************************
  database_name: employees
     table_name: salaries
     index_name: emp_no
   compress_ops: 0
compress_ops_ok: 0
  compress_time: 0
 uncompress_ops: 1597
uncompress_time: 0

Notes:

24.33.8 The INFORMATION_SCHEMA INNODB_FT_BEING_DELETED Table

The INNODB_FT_BEING_DELETED table is a snapshot of the INNODB_FT_DELETED table that is only used during an OPTIMIZE TABLE maintenance operation. When OPTIMIZE TABLE is run, the INNODB_FT_BEING_DELETED table is emptied, and DOC_IDs are removed from the INNODB_FT_DELETED table. Because the contents of INNODB_FT_BEING_DELETED typically have a short lifetime, this table has limited utility for monitoring or debugging. For information about running OPTIMIZE TABLE on tables with FULLTEXT indexes, see Section 12.9.6, “Fine-Tuning MySQL Full-Text Search”.

This table initially appears empty, until you set the value of the configuration variable innodb_ft_aux_table. The output appears similar to the example provided for the INNODB_FT_DELETED table.

For related usage information and examples, see Section 15.14.4, “InnoDB INFORMATION_SCHEMA FULLTEXT Index Tables”.

Table 24.8 INNODB_FT_BEING_DELETED Columns

Column name Description
DOC_ID The document ID of the row that is in the process of being deleted. This value might reflect the value of an ID column that you defined for the underlying table, or it can be a sequence value generated by InnoDB when the table does not contain a suitable column. This value is used to skip rows in the innodb_ft_index_table table, when you do text searches before data for deleted rows is physically removed from the FULLTEXT index by an OPTIMIZE TABLE statement. See Optimizing InnoDB Full-Text Indexes for more information.

Notes:

24.33.9 The INFORMATION_SCHEMA INNODB_FT_CONFIG Table

The INNODB_FT_CONFIG table displays metadata about the FULLTEXT index and associated processing for an InnoDB table.

Before you query this table, set the configuration variable innodb_ft_aux_table to the name (including the database name) of the table that contains the FULLTEXT index, for example test/articles.

For related usage information and examples, see Section 15.14.4, “InnoDB INFORMATION_SCHEMA FULLTEXT Index Tables”.

Table 24.9 INNODB_FT_CONFIG Columns

Column name Description
KEY The name designating an item of metadata for an InnoDB table containing a FULLTEXT index.
VALUE The value associated with the corresponding KEY column, reflecting some limit or current value for an aspect of a FULLTEXT index for an InnoDB table.

Example:

mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_CONFIG;
+---------------------------+-------------------+
| KEY                       | VALUE             |
+---------------------------+-------------------+
| optimize_checkpoint_limit | 180               |
| synced_doc_id             | 0                 |
| stopword_table_name       | test/my_stopwords |
| use_stopword              | 1                 |
+---------------------------+-------------------+

Notes:

  • This table is only intended for internal configuration. It is not intended for statistical information purposes.

  • Use DESCRIBE or SHOW COLUMNS to view additional information about the columns of this table including data types and default values.

  • You must have the PROCESS privilege to query this table.

  • The values for the KEY column might evolve depending on the needs for performance tuning and debugging for InnoDB full-text processing. The key values include:

    • optimize_checkpoint_limit: The number of seconds after which an OPTIMIZE TABLE run will stop.

    • synced_doc_id: The next DOC_ID to be issued.

    • stopword_table_name: The database/table name for a user defined stopword table. This field appears empty if there is no user-defined stopword table.

    • use_stopword: Indicates whether or not a stopword table is used, which is defined when the FULLTEXT index is created.

  • For more information about InnoDB FULLTEXT search, see Section 15.8.2.4, “InnoDB FULLTEXT Indexes”, and Section 12.9, “Full-Text Search Functions”.

24.33.10 The INFORMATION_SCHEMA INNODB_FT_DEFAULT_STOPWORD Table

The INNODB_FT_DEFAULT_STOPWORD table holds a list of stopwords that are used by default when creating a FULLTEXT index on an InnoDB table. For information about the default InnoDB stopword list and how to define your own stopword lists, see Section 12.9.4, “Full-Text Stopwords”.

For related usage information and examples, see Section 15.14.4, “InnoDB INFORMATION_SCHEMA FULLTEXT Index Tables”.

Table 24.10 INNODB_FT_DEFAULT_STOPWORD Columns

Column name Description
value A word that is used by default as a stopword for FULLTEXT indexes on InnoDB tables. Not used if you override the default stopword processing with either the innodb_ft_server_stopword_table or the innodb_ft_user_stopword_table option.

Example:

mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DEFAULT_STOPWORD;
+-------+
| value |
+-------+
| a     |
| about |
| an    |
| are   |
| as    |
| at    |
| be    |
| by    |
| com   |
| de    |
| en    |
| for   |
| from  |
| how   |
| i     |
| in    |
| is    |
| it    |
| la    |
| of    |
| on    |
| or    |
| that  |
| the   |
| this  |
| to    |
| was   |
| what  |
| when  |
| where |
| who   |
| will  |
| with  |
| und   |
| the   |
| www   |
+-------+
36 rows in set (0.00 sec)

Notes:

24.33.11 The INFORMATION_SCHEMA INNODB_FT_DELETED Table

The INNODB_FT_DELETED table records rows that are deleted from the FULLTEXT index for an InnoDB table. To avoid expensive index reorganization during DML operations for an InnoDB FULLTEXT index, the information about newly deleted words is stored separately, filtered out of search results when you do a text search, and removed from the main search index only when you issue the OPTIMIZE TABLE statement for the InnoDB table. See Optimizing InnoDB Full-Text Indexes for more information.

This table initially appears empty, until you set the value of the configuration variable innodb_ft_aux_table to the name (including the database name) of the table that contains the FULLTEXT index, for example test/articles.

For related usage information and examples, see Section 15.14.4, “InnoDB INFORMATION_SCHEMA FULLTEXT Index Tables”.

Table 24.11 INNODB_FT_DELETED Columns

Column name Description
DOC_ID The document ID of the newly deleted row. This value might reflect the value of an ID column that you defined for the underlying table, or it can be a sequence value generated by InnoDB when the table does not contain a suitable column. This value is used to skip rows in the innodb_ft_index_table table, when you do text searches before data for deleted rows is physically removed from the FULLTEXT index by an OPTIMIZE TABLE statement. See Optimizing InnoDB Full-Text Indexes for more information.

Example:

mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DELETED;
+--------+
| DOC_ID |
+--------+
|      6 |
|      7 |
|      8 |
+--------+

Notes:

24.33.12 The INFORMATION_SCHEMA INNODB_FT_INDEX_CACHE Table

INNODB_FT_INDEX_CACHE: Contains token information about newly inserted rows in a FULLTEXT index. To avoid expensive index reorganization during DML operations, the information about newly indexed words is stored separately, and combined with the main search index only when OPTIMIZE TABLE is run, when the server is shut down, or when the cache size exceeds a limit defined by innodb_ft_cache_size or innodb_ft_total_cache_size.

Before you query this table, set the configuration variable innodb_ft_aux_table to the name (including the database name) of the table that contains the FULLTEXT index, for example test/articles.

For related usage information and examples, see Section 15.14.4, “InnoDB INFORMATION_SCHEMA FULLTEXT Index Tables”.

Table 24.12 INNODB_FT_INDEX_CACHE Columns

Column name Description
WORD A word extracted from the text of a newly inserted row.
FIRST_DOC_ID The first document ID that this word appears in the FULLTEXT index.
LAST_DOC_ID The last document ID that this word appears in the FULLTEXT index.
DOC_COUNT The number of rows this word appears in the FULLTEXT index. The same word can occur several times within the cache table, once for each combination of DOC_ID and POSITION values.
DOC_ID The document ID of the newly inserted row. This value might reflect the value of an ID column that you defined for the underlying table, or it can be a sequence value generated by InnoDB when the table does not contain a suitable column.
POSITION The position of this particular instance of the word within the relevant document identified by the DOC_ID value. The value does not represent an absolute position; it is an offset added to the POSITION of the previous instance of that word.

Notes:

  • This table initially appears empty, until you set the value of the configuration variable innodb_ft_aux_table. The following example demonstrates how to use the innodb_ft_aux_table option to show information about a FULLTEXT index for a specified table.

    mysql> USE test;
    
    mysql> CREATE TABLE articles (
          id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
          title VARCHAR(200),
          body TEXT,
          FULLTEXT (title,body)
        ) ENGINE=InnoDB;
    
    mysql> INSERT INTO articles (title,body) VALUES
        ('MySQL Tutorial','DBMS stands for DataBase ...'),
        ('How To Use MySQL Well','After you went through a ...'),
        ('Optimizing MySQL','In this tutorial we will show ...'),
        ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
        ('MySQL vs. YourSQL','In the following database comparison ...'),
        ('MySQL Security','When configured properly, MySQL ...');
    
    mysql> SET GLOBAL innodb_ft_aux_table = 'test/articles';
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> USE INFORMATION_SCHEMA;
    
    mysql> SELECT word, doc_count, doc_id, position FROM INNODB_FT_INDEX_CACHE LIMIT 5;
    +------------+-----------+--------+----------+
    | word       | doc_count | doc_id | position |
    +------------+-----------+--------+----------+
    | 1001       |         1 |      4 |        0 |
    | after      |         1 |      2 |       22 |
    | comparison |         1 |      5 |       44 |
    | configured |         1 |      6 |       20 |
    | database   |         2 |      1 |       31 |
    +------------+-----------+--------+----------+
    
  • Use DESCRIBE or SHOW COLUMNS to view additional information about the columns of this table including data types and default values.

  • You must have the PROCESS privilege to query this table.

  • For more information about InnoDB FULLTEXT search, see Section 15.8.2.4, “InnoDB FULLTEXT Indexes”, and Section 12.9, “Full-Text Search Functions”.

24.33.13 The INFORMATION_SCHEMA INNODB_FT_INDEX_TABLE Table

The INNODB_FT_INDEX_TABLE table displays information about the inverted index used to process text searches against the FULLTEXT index of an InnoDB table.

For related usage information and examples, see Section 15.14.4, “InnoDB INFORMATION_SCHEMA FULLTEXT Index Tables”.

Before you query this table, set the configuration variable innodb_ft_aux_table to the name (including the database name) of the table that contains the FULLTEXT index, for example test/articles.

Table 24.13 INNODB_FT_INDEX_TABLE Columns

Column name Description
WORD A word extracted from the text of the columns that are part of a FULLTEXT.
FIRST_DOC_ID The first document ID that this word appears in the FULLTEXT index.
LAST_DOC_ID The last document ID that this word appears in the FULLTEXT index.
DOC_COUNT The number of rows this word appears in the FULLTEXT index. The same word can occur several times within the cache table, once for each combination of DOC_ID and POSITION values.
DOC_ID The document ID of the row containing the word. This value might reflect the value of an ID column that you defined for the underlying table, or it can be a sequence value generated by InnoDB when the table does not contain a suitable column.
POSITION The position of this particular instance of the word within the relevant document identified by the DOC_ID value.

Notes:

  • This table initially appears empty, until you set the value of the configuration variable innodb_ft_aux_table. The following example demonstrates how to use the innodb_ft_aux_table option to show information about a FULLTEXT index for a specified table. Before information for newly inserted rows appears in INNODB_FT_INDEX_TABLE, the FULLTEXT index cache must be flushed to disk. This is accomplished by running an OPTIMIZE TABLE operation on the indexed table with innodb_optimize_fulltext_only=ON.

    mysql> USE test;
    
    mysql> CREATE TABLE articles (
          id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
          title VARCHAR(200),
          body TEXT,
          FULLTEXT (title,body)
        ) ENGINE=InnoDB;
    
    mysql> INSERT INTO articles (title,body) VALUES
        ('MySQL Tutorial','DBMS stands for DataBase ...'),
        ('How To Use MySQL Well','After you went through a ...'),
        ('Optimizing MySQL','In this tutorial we will show ...'),
        ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
        ('MySQL vs. YourSQL','In the following database comparison ...'),
        ('MySQL Security','When configured properly, MySQL ...');
    
    mysql> SET GLOBAL innodb_optimize_fulltext_only=ON;
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> OPTIMIZE TABLE articles;
    +---------------+----------+----------+----------+
    | Table         | Op       | Msg_type | Msg_text |
    +---------------+----------+----------+----------+
    | test.articles | optimize | status   | OK       |
    +---------------+----------+----------+----------+
    
    mysql> SET GLOBAL innodb_ft_aux_table = 'test/articles';
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> USE INFORMATION_SCHEMA;
    
    mysql> SELECT word, doc_count, doc_id, position FROM INNODB_FT_INDEX_TABLE LIMIT 5;
    +------------+-----------+--------+----------+
    | word       | doc_count | doc_id | position |
    +------------+-----------+--------+----------+
    | 1001       |         1 |      4 |        0 |
    | after      |         1 |      2 |       22 |
    | comparison |         1 |      5 |       44 |
    | configured |         1 |      6 |       20 |
    | database   |         2 |      1 |       31 |
    +------------+-----------+--------+----------+
    
  • Use DESCRIBE or SHOW COLUMNS to view additional information about the columns of this table including data types and default values.

  • You must have the PROCESS privilege to query this table.

  • For more information about InnoDB FULLTEXT search, see Section 15.8.2.4, “InnoDB FULLTEXT Indexes”, and Section 12.9, “Full-Text Search Functions”.

24.33.14 The INFORMATION_SCHEMA INNODB_LOCKS Table

The INNODB_LOCKS table contains information about each lock that an InnoDB transaction has requested but not yet acquired, and each lock that a transaction holds that is blocking another transaction.

Note

This table is deprecated and is removed as of MySQL 8.0.1. Use the Performance Schema data_locks table instead. See Section 25.11.12.1, “The data_locks Table”.

Differences between INNODB_LOCKS and data_locks:

  • If a transaction holds a lock, INNODB_LOCKS displays the lock only if another transaction is waiting for it. data_locks displays the lock regardless of whether any transaction is waiting for it.

  • The data_locks table has no columns corresponding to LOCK_SPACE, LOCK_PAGE, or LOCK_REC.

  • The INNODB_LOCKS table requires the global PROCESS privilege. The data_locks table requires the usual Performance Schema privilege of SELECT on the table to be selected from.

The following table shows the mapping from INNODB_LOCKS columns to data_locks columns. Use this information to migrate applications from one table to the other.

Table 24.14 Mapping from INNODB_LOCKS to data_locks Columns

INNODB_LOCKS Column data_locks Column
LOCK_ID ENGINE_LOCK_ID
LOCK_TRX_ID ENGINE_TRANSACTION_ID
LOCK_MODE LOCK_MODE
LOCK_TYPE LOCK_TYPE
LOCK_TABLE (combined schema/table names) OBJECT_SCHEMA (schema name), OBJECT_NAME (table name)
LOCK_INDEX INDEX_NAME
LOCK_SPACE None
LOCK_PAGE None
LOCK_REC None
LOCK_DATA LOCK_DATA

24.33.15 The INFORMATION_SCHEMA INNODB_LOCK_WAITS Table

The INNODB_LOCK_WAITS table contains one or more rows for each blocked InnoDB transaction, indicating the lock it has requested and any locks that are blocking that request.

Note

This table is deprecated and is removed as of MySQL 8.0.1. Use the Performance Schema data_lock_waits table instead. See Section 25.11.12.2, “The data_lock_waits Table”.

The tables differ in the privileges required: The INNODB_LOCK_WAITS table requires the global PROCESS privilege. The data_lock_waits table requires the usual Performance Schema privilege of SELECT on the table to be selected from.

The following table shows the mapping from INNODB_LOCK_WAITS columns to data_lock_waits columns. Use this information to migrate applications from one table to the other.

Table 24.15 Mapping from INNODB_LOCK_WAITS to data_lock_waits Columns

INNODB_LOCK_WAITS Column data_lock_waits Column
REQUESTING_TRX_ID REQUESTING_ENGINE_TRANSACTION_ID
REQUESTED_LOCK_ID REQUESTING_ENGINE_LOCK_ID
BLOCKING_TRX_ID BLOCKING_ENGINE_TRANSACTION_ID
BLOCKING_LOCK_ID BLOCKING_ENGINE_LOCK_ID

24.33.16 The INFORMATION_SCHEMA INNODB_METRICS Table

This INFORMATION_SCHEMA table presents a wide variety of InnoDB performance information, complementing the specific focus areas of the PERFORMANCE_SCHEMA tables for InnoDB. With simple queries, you can check the overall health of the system. With more detailed queries, you can diagnose issues such as performance bottlenecks, resource shortages, and application issues.

Each monitor represents a point within the InnoDB source code that is instrumented to gather counter information. Each counter can be started, stopped, and reset. You can also perform these actions for a group of counters using their common module name.

By default, relatively little data is collected. To start, stop, and reset counters, you set one of the configuration options innodb_monitor_enable, innodb_monitor_disable, innodb_monitor_reset, or innodb_monitor_reset_all, using the name of the counter, the name of the module, a wildcard match for such a name using the % character, or the special keyword all.

For usage information, see Section 15.14.6, “InnoDB INFORMATION_SCHEMA Metrics Table”.

Table 24.16 INNODB_METRICS Columns

Column name Description
NAME Unique name for the counter.
SUBSYSTEM The aspect of InnoDB that the metric applies to. See the list following the table for the corresponding module names to use with the SET GLOBAL syntax.
COUNT Value since the counter is enabled.
MAX_COUNT Maximum value since the counter is enabled.
MIN_COUNT Minimum value since the counter is enabled.
AVG_COUNT Average value since the counter is enabled.
COUNT_RESET Counter value since it was last reset. (The _RESET fields act like the lap counter on a stopwatch: you can measure the activity during some time interval, while the cumulative figures are still available in the COUNT, MAX_COUNT, and so on fields.)
MAX_COUNT_RESET Maximum counter value since it was last reset.
MIN_COUNT_RESET Minimum counter value since it was last reset.
AVG_COUNT_RESET Average counter value since it was last reset.
TIME_ENABLED Timestamp of last start.
TIME_DISABLED Timestamp of last stop.
TIME_ELAPSED Elapsed time in seconds since the counter started.
TIME_RESET Timestamp of last stop.
STATUS Whether the counter is still running (enabled) or stopped (disabled).
TYPE Whether the item is a cumulative counter, or measures the current value of some resource.
COMMENT Counter description.

Example:

mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME="dml_inserts"\G
*************************** 1. row ***************************
           NAME: dml_inserts
      SUBSYSTEM: dml
          COUNT: 3
      MAX_COUNT: 3
      MIN_COUNT: NULL
      AVG_COUNT: 0.046153846153846156
    COUNT_RESET: 3
MAX_COUNT_RESET: 3
MIN_COUNT_RESET: NULL
AVG_COUNT_RESET: NULL
   TIME_ENABLED: 2014-12-04 14:18:28
  TIME_DISABLED: NULL
   TIME_ELAPSED: 65
     TIME_RESET: NULL
         STATUS: enabled
           TYPE: status_counter
        COMMENT: Number of rows inserted

Notes:

  • You must have the PROCESS privilege to query this table.

  • Use DESCRIBE or SHOW COLUMNS to view additional information about the columns of this table including data types and default values.

24.33.17 The INFORMATION_SCHEMA INNODB_COLUMNS Table

The INNODB_COLUMNS table provides metadata about InnoDB table columns.

For related usage information and examples, see Section 15.14.3, “InnoDB INFORMATION_SCHEMA Schema Object Tables”.

Table 24.17 INNODB_COLUMNS Columns

Column name Description
TABLE_ID An identifier representing the table associated with the column; the same value from INNODB_TABLES.TABLE_ID.
NAME The name of each column in each table. These names can be uppercase or lowercase depending on the lower_case_table_names setting. There are no special system-reserved names for columns.
POS The ordinal position of the column within the table, starting from 0 and incrementing sequentially. When a column is dropped, the remaining columns are reordered so that the sequence has no gaps. The POS value for a virtual generated column encodes the column sequence number and ordinal position of the column. For more information, see the POS column description in Section 24.33.27, “The INFORMATION_SCHEMA INNODB_VIRTUAL Table”.
MTYPE Stands for main type. A numeric identifier for the column type. 1 = VARCHAR, 2 = CHAR, 3 = FIXBINARY, 4 = BINARY, 5 = BLOB, 6 = INT, 7 = SYS_CHILD, 8 = SYS, 9 = FLOAT, 10 = DOUBLE, 11 = DECIMAL, 12 = VARMYSQL, 13 = MYSQL, 14 = GEOMETRY.
PRTYPE The InnoDB precise type, a binary value with bits representing MySQL data type, character set code, and nullability.
LEN The column length, for example 4 for INT and 8 for BIGINT. For character columns in multibyte character sets, this length value is the maximum length in bytes needed to represent a definition such as VARCHAR(N); that is, it might be 2*N, 3*N, and so on depending on the character encoding.

Example:

mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_COLUMNS where TABLE_ID = 71\G
*************************** 1. row ***************************
TABLE_ID: 71
    NAME: col1
     POS: 0
   MTYPE: 6
  PRTYPE: 1027
     LEN: 4
*************************** 2. row ***************************
TABLE_ID: 71
    NAME: col2
     POS: 1
   MTYPE: 2
  PRTYPE: 524542
     LEN: 10
*************************** 3. row ***************************
TABLE_ID: 71
    NAME: col3
     POS: 2
   MTYPE: 1
  PRTYPE: 524303
     LEN: 10

Notes:

  • Use DESCRIBE or SHOW COLUMNS to view additional information about the columns of this table including data types and default values.

  • You must have the PROCESS privilege to query this table.

24.33.18 The INFORMATION_SCHEMA INNODB_DATAFILES Table

The INNODB_DATAFILES table provides data file path information for InnoDB file-per-table and general tablespaces.

For related usage information and examples, see Section 15.14.3, “InnoDB INFORMATION_SCHEMA Schema Object Tables”.

Note

The INFORMATION_SCHEMA.FILES table reports metadata for all InnoDB tablespace types including file-per-table tablespaces, general tablespaces, the system tablespace, the temporary tablespace, and undo tablespaces.

Table 24.18 INNODB_DATAFILES Columns

Column name Description
SPACE The tablespace Space ID.
PATH The tablespace data file path. If a file-per-table tablespace is created in a location outside the MySQL data directory, the path value is a fully qualified directory path.

Example:

mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_DATAFILES WHERE SPACE = 57\G
*************************** 1. row ***************************
SPACE: 57
 PATH: ./test/t1.ibd

Notes:

  • Use DESCRIBE or SHOW COLUMNS to view additional information about the columns of this table including data types and default values.

  • You must have the PROCESS privilege to query this table.

24.33.19 The INFORMATION_SCHEMA INNODB_FIELDS Table

The INNODB_FIELDS table provides metadata about the key columns (fields) of InnoDB indexes.

For related usage information and examples, see Section 15.14.3, “InnoDB INFORMATION_SCHEMA Schema Object Tables”.

Table 24.19 INNODB_FIELDS Columns

Column name Description
INDEX_ID An identifier for the index associated with this key field, using the same value as in INNODB_INDEXES.INDEX_ID.
NAME The name of the original column from the table, using the same value as in INNODB_COLUMNS.NAME.
POS The ordinal position of the key field within the index, starting from 0 and incrementing sequentially. When a column is dropped, the remaining columns are reordered so that the sequence has no gaps.

Example:

mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_FIELDS WHERE INDEX_ID = 117\G
*************************** 1. row ***************************
INDEX_ID: 117
    NAME: col1
     POS: 0

Notes:

  • Use DESCRIBE or SHOW COLUMNS to view additional information about the columns of this table including data types and default values.

  • You must have the PROCESS privilege to query this table.

24.33.20 The INFORMATION_SCHEMA INNODB_FOREIGN Table

The INNODB_FOREIGN table provides metadata about InnoDB foreign keys.

For related usage information and examples, see Section 15.14.3, “InnoDB INFORMATION_SCHEMA Schema Object Tables”.

Table 24.20 INNODB_FOREIGN Columns

Column name Description
ID The name (not a numeric value) of the foreign key index. Preceded by the database name, for example, test/products_fk.
FOR_NAME The name of the child table in this foreign key relationship.
REF_NAME The name of the parent table in this foreign key relationship.
N_COLS The number of columns in the foreign key index.
TYPE A collection of bit flags with information about the foreign key column, ORed together. 1 = ON DELETE CASCADE, 2 = ON UPDATE SET NULL, 4 = ON UPDATE CASCADE, 8 = ON UPDATE SET NULL, 16 = ON DELETE NO ACTION, 32 = ON UPDATE NO ACTION.

Example:

mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_FOREIGN\G
*************************** 1. row ***************************
      ID: test/fk1
FOR_NAME: test/child
REF_NAME: test/parent
  N_COLS: 1
    TYPE: 1

Notes:

  • Use DESCRIBE or SHOW COLUMNS to view additional information about the columns of this table including data types and default values.

  • You must have the PROCESS privilege to query this table.

24.33.21 The INFORMATION_SCHEMA INNODB_FOREIGN_COLS Table

The INNODB_FOREIGN_COLS table provides status information about the columns of InnoDB foreign keys.

For related usage information and examples, see Section 15.14.3, “InnoDB INFORMATION_SCHEMA Schema Object Tables”.

Table 24.21 INNODB_FOREIGN_COLS Columns

Column name Description
ID The foreign key index associated with this index key field, using the same value as INNODB_FOREIGN.ID.
FOR_COL_NAME The name of the associated column in the child table.
REF_COL_NAME The name of the associated column in the parent table.
POS The ordinal position of this key field within the foreign key index, starting from 0.

Example:

mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_FOREIGN_COLS WHERE ID = 'test/fk1'\G
*************************** 1. row ***************************
          ID: test/fk1
FOR_COL_NAME: parent_id
REF_COL_NAME: id
         POS: 0

Notes:

  • Use DESCRIBE or SHOW COLUMNS to view additional information about the columns of this table including data types and default values.

  • You must have the PROCESS privilege to query this table.

24.33.22 The INFORMATION_SCHEMA INNODB_INDEXES Table

The INNODB_INDEXES table provides metadata about InnoDB indexes.

For related usage information and examples, see Section 15.14.3, “InnoDB INFORMATION_SCHEMA Schema Object Tables”.

Table 24.22 INNODB_INDEXES Columns

Column name Description
INDEX_ID An identifier for each index that is unique across all the databases in an instance.
NAME The name of the index. Most indexes created implicitly by InnoDB have consistent names but the index names are not necessarily unique. For example, PRIMARY for a primary key index, GEN_CLUST_INDEX for the index representing a primary key when one is not specified, and ID_IND, FOR_IND, and REF_IND for foreign key constraints.
TABLE_ID An identifier representing the table associated with the index; the same value from INNODB_TABLES.TABLE_ID.
TYPE A numeric identifier signifying the kind of index. 0 = Secondary Index, 1 = Clustered Index, 2 = Unique Index, 3 = Primary Index, 32 = Full-text Index, 64 = Spatial Index, 128 = A secondary index that includes a virtual generated column.
N_FIELDS The number of columns in the index key. For the GEN_CLUST_INDEX indexes, this value is 0 because the index is created using an artificial value rather than a real table column.
PAGE_NO The root page number of the index B-tree. For full-text indexes, the PAGE_NO field is unused and set to -1 (FIL_NULL) because the full-text index is laid out in several B-trees (auxiliary tables).
SPACE An identifier for the tablespace where the index resides. 0 means the InnoDB system tablespace. Any other number represents a table created in file-per-table mode with a separate .ibd file. This identifier stays the same after a TRUNCATE TABLE statement. Because all indexes for a table reside in the same tablespace as the table, this value is not necessarily unique.
MERGE_THRESHOLD The merge threshold value for index pages. If the amount of data in an index page falls below the MERGE_THRESHOLD value when a row is deleted or when a row is shortened by an update operation, InnoDB attempts to merge the index page with the neighboring index page. The default threshold value is 50%. For more information, see Section 15.6.12, “Configuring the Merge Threshold for Index Pages”.

Example:

mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_INDEXES WHERE TABLE_ID = 34\G
*************************** 1. row ***************************
       INDEX_ID: 39
           NAME: GEN_CLUST_INDEX
       TABLE_ID: 34
           TYPE: 1
       N_FIELDS: 0
        PAGE_NO: 3
          SPACE: 23
MERGE_THRESHOLD: 50
*************************** 2. row ***************************
       INDEX_ID: 40
           NAME: i1
       TABLE_ID: 34
           TYPE: 0
       N_FIELDS: 1
        PAGE_NO: 4
          SPACE: 23
MERGE_THRESHOLD: 50

Notes:

  • Use DESCRIBE or SHOW COLUMNS to view additional information about the columns of this table including data types and default values.

  • You must have the PROCESS privilege to query this table.

24.33.23 The INFORMATION_SCHEMA INNODB_TABLES Table

The INNODB_TABLES table provides metadata about InnoDB tables.

For related usage information and examples, see Section 15.14.3, “InnoDB INFORMATION_SCHEMA Schema Object Tables”.

Table 24.23 INNODB_TABLES Columns

Column name Description
TABLE_ID An identifier for each InnoDB table that is unique across all databases in the instance.
NAME The name of the table. Preceded by the database name where appropriate, for example test/t1. Names of databases and user tables are in the same case as they were originally defined, possibly influenced by the lower_case_table_names setting.
FLAG Bit-level data about table format and storage characteristics including row format, compressed page size (if applicable), and whether or not the DATA DIRECTORY clause was used with CREATE TABLE or ALTER TABLE.
N_COLS The number of columns in the table. The number reported includes three hidden columns that are created by InnoDB (DB_ROW_ID, DB_TRX_ID, and DB_ROLL_PTR). The number reported also includes virtual generated columns, if present.
SPACE An identifier for the tablespace where the table resides. 0 means the InnoDB system tablespace. Any other number represents either a file-per-table tablespace or a general tablespace. This identifier stays the same after a TRUNCATE TABLE statement. For file-per-table tablespaces, this identifier is unique for tables across all databases in the instance.
ROW_FORMAT The table's row format (Compact, Redundant, Dynamic, or Compressed).
ZIP_PAGE_SIZE The zip page size. Only applies to tables that use the Compressed row format.
SPACE_TYPE The type of tablespace to which the table belongs. Possible values include System for the system tablespace, General for general tablespaces, and Single for file-per-table tablespaces. Tables assigned to the system tablespace using CREATE TABLE or ALTER TABLE TABLESPACE=innodb_system have a General SPACE_TYPE. For more information, see CREATE TABLESPACE.

Example:

mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLES WHERE TABLE_ID = 214\G
*************************** 1. row ***************************
     TABLE_ID: 214
         NAME: test/t1
         FLAG: 129
       N_COLS: 4
        SPACE: 233
   ROW_FORMAT: Compact
ZIP_PAGE_SIZE: 0
   SPACE_TYPE: General

Notes:

  • Use DESCRIBE or SHOW COLUMNS to view additional information about the columns of this table including data types and default values.

  • You must have the PROCESS privilege to query this table.

Interpreting the INNODB_TABLES.FLAG Column Value:

The INNODB_TABLES.FLAG column provides bit-level information about the table's format and storage characteristics. You can interpret the FLAG column value by adding together the applicable decimal numeric values that are provided in the following table.

Table 24.24 Bit Position Values for Interpreting INNODB_TABLES FLAG Column Data

Bit Position Description Decimal Numeric Value
0 This bit is set if the row format is not REDUNDANT. In other words, it is set if the row format is COMPACT, DYNAMIC or COMPRESSED.
  • 0 - REDUNDANT

  • 1 - COMPACT, DYNAMIC or COMPRESSED

1-4 These four bits contain a small number that represents the compressed page size of the table. The INNODB_TABLES.ZIP_PAGE_SIZE field also reports the compressed page size, if applicable.
  • 0 - Not Compressed

  • 2 - 1024 Byte Compressed Page Size

  • 4 - 2048 Byte Compressed Page Size

  • 6 - 4096 Byte Compressed Page Size

  • 8 - 8192 Byte Compressed Page Size

  • 10 - 16384 Byte Compressed Page Size

5 This bit is set if the row format is DYNAMIC or COMPRESSED.
  • 0 - REDUNDANT or COMPACT

  • 32 - DYNAMIC or COMPRESSED

6 This bit is set if the DATA DIRECTORY option is used with CREATE TABLE or ALTER TABLE. This bit is set for file-per-table tablespaces that are located in directories other than the default data directory (datadir).
  • 0 - Not a remote file-per-table tablespace

  • 64 - A remote file-per-table tablespace

7 This bit is set if the table is assigned to a shared tablespace (either a general tablespace or a system tablespace) using the CREATE TABLE or ALTER TABLE TABLESPACE=tablespace_name option.
  • 0 - Table is located in a default location depending on the value of the innodb_file_per_table.

  • 128 - The table is explicitly assigned to a shared tablespace.


In the following, table t1 uses ROW_FORMAT=DYNAMIC and has a FLAG value of 33. Based on the information in the preceding table, we can see that bit position 0 would be set to 1, and bit position 5 would be set to 32 for a table with a DYNAMIC row format. These values add up to a FLAG value of 33.

mysql> USE test;
Database changed

mysql> CREATE TABLE t1 (c1 int) ROW_FORMAT=DYNAMIC;
Query OK, 0 rows affected (0.02 sec)

mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLES WHERE NAME LIKE 'test/t1'\G
*************************** 1. row ***************************
     TABLE_ID: 89
         NAME: test/t1
         FLAG: 33
       N_COLS: 4
        SPACE: 75
   ROW_FORMAT: Dynamic
ZIP_PAGE_SIZE: 0
1 row in set (0.00 sec)

24.33.24 The INFORMATION_SCHEMA INNODB_TABLESPACES Table

The INNODB_TABLESPACES table provides metadata about InnoDB file-per-table and general tablespaces.

For related usage information and examples, see Section 15.14.3, “InnoDB INFORMATION_SCHEMA Schema Object Tables”.

Note

The INFORMATION_SCHEMA.FILES table reports metadata for all InnoDB tablespace types including file-per-table tablespaces, general tablespaces, the system tablespace, the temporary tablespace, and undo tablespaces.

Table 24.25 INNODB_TABLESPACES Columns

Column name Description
SPACE Tablespace Space ID.
NAME The database and table name.
FLAG Bit-level data about tablespace format and storage characteristics.
ROW_FORMAT The tablespace row format (Compact or Redundant, Dynamic, or Compressed). The data in this field is interpreted from the tablespace flags information that resides in the .ibd file.
PAGE_SIZE The tablespace page size. The data in this field is interpreted from the tablespace flags information that resides in the .ibd file.
ZIP_PAGE_SIZE The tablespace zip page size. The data in this field is interpreted from the tablespace flags information that resides in the .ibd file.
SPACE_TYPE The type of tablespace. Possible values include General for general tablespaces, Single for file-per-table tablespaces, and System for the system tablespace.
FS_BLOCK_SIZE The file system block size, which is the unit size used for hole punching. This column was added with the introduction of the InnoDB transparent page compression feature.
FILE_SIZE The apparent size of the file, which represents the maximum size of the file, uncompressed. This column was added with the introduction of the InnoDB transparent page compression feature.
ALLOCATED_SIZE The actual size of the file, which is the amount of space allocated on disk. This column was added with the introduction of the InnoDB transparent page compression feature.
SERVER_VERSION Defines the 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.0.x to 8.0.y. The value can be considered a creation marker or certified marker for the tablespace.
SPACE_VERSION Defines the tablespace version, used to changes to the tablespace format.

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
SERVER_VERSION: 8.0.4
 SPACE_VERSION: 1

Notes:

  • Use DESCRIBE or SHOW COLUMNS to view additional information about the columns of this table including data types and default values.

  • You must have the PROCESS privilege to query this table.

  • There is no way to determine from this flag integer if the tablespace row format is Redundant or Compact. As a result, the possible values for the ROW_FORMAT field are Compact or Redundant, Compressed, or Dynamic.

Interpreting the INNODB_TABLESPACES.FLAG Column Value:

The INNODB_TABLESPACES.FLAG column provides bit-level information about tablespace format and storage characteristics.

You can interpret the tablespace FLAG column value by adding together the applicable decimal numeric values that are provided in the following table.

Table 24.26 Bit Position Values for Interpreting INNODB_TABLESPACES FLAG Column Data

Bit Position Description Decimal Numeric Value
0 This bit is set if the row format of tables in the tablespace is DYNAMIC or COMPRESSED. If the bit is not set, the row format of tables in the tablespace may be either REDUNDANT or COMPACT. If it is a file-per-table tablespace, you can query INNODB_TABLES to determine if the row format is REDUNDANT or COMPACT.
  • 0 - REDUNDANT or COMPACT

  • 1 - DYNAMIC or COMPRESSED

1-4 These four bits contain a small number that represents the compressed page size (the KEY_BLOCK_SIZE or physical block size) of the tablespace.
  • 0 - Not Compressed

  • 2 - 1024 Byte Compressed Page Size

  • 4 - 2048 Byte Compressed Page Size

  • 6 - 4096 Byte Compressed Page Size

  • 8 - 8192 Byte Compressed Page Size

  • 10 - 16384 Byte Compressed Page Size

  • 12 - 32768 Byte Compressed Page Size

  • 14 - 65536 Byte Compressed Page Size

5 This bit is set for file-per-table tablespaces if the row format of the table is DYNAMIC or COMPRESSED. General tablespaces that do not contain compressed tables will have the first 6 bits set to zero, including this bit, making it appear that the tablespace holds REDUNDANT or COMPACT tables. But actually, general tablespaces may contain any combination of REDUNDANT, COMPACT and DYNAMIC tables. For more information about general tablespaces, see CREATE TABLESPACE.
  • 0 - REDUNDANT or COMPACT

  • 32 - DYNAMIC or COMPRESSED

6-9 These four bits contain a small number that represents the uncompressed page size (logical page size) of the tablespace. The setting is zero if the logical page size is the original InnoDB default page size of 16K.
  • 192 - 4096 Byte Logical/Uncompressed Page Size

  • 256 - 8192 Byte Logical/Uncompressed Page Size

  • 0 - 16384 Byte Logical/Uncompressed Page size

  • 384 - 32768 Byte Logical/Uncompressed Page Size

  • 448 - 65536 Byte Logical/Uncompressed Page Size

10 This bit is set if the DATA DIRECTORY option is used with CREATE TABLE or ALTER TABLE. This bit is set for file-per-table tablespaces that are located in directories other than the default data directory (datadir).
  • 0 - Not a remote file-per-table tablespace

  • 1024 - A remote file-per-table tablespace

11 This bit is set if the tablespace is a shared general tablespace created using CREATE TABLESPACE.
  • 0 - Table is located in a default location depending on the value of the innodb_file_per_table setting.

  • 2048 - The table was explicitly assigned to a shared tablespace.

12 This bit is set if the tablespace is dedicated to temporary tables. Only the predefined ibtmp1 tablespace uses this flag.
  • 0 - The tablespace does not contain temporary tables, so it is not recreated upon startup.

  • 4096 - The tablespace contains temporary tables and is recreated on startup.


In the following example, table t1 is created with innodb_file_per_table=ON, which creates table t1 in its own tablespace. When querying INNODB_TABLESPACES, we see that the tablespace has a FLAG value of 33. To determine how this value is arrived at, review the bit values described in the preceding table. Bit 0 has a value of 1 because table t1 uses the DYNAMIC row format. Bit 5 has a value of 32 because the tablespace is a file-per-table tablespace that uses a DYNAMIC row format. Bit position 6-9 is 0 because innodb_page_size is set to the default 16K value. The other bit values are not applicable and are therefore set to 0. The values for bit position 0 and bit position 5 add up to a FLAG value of 33.

mysql> USE test;
Database changed

mysql> SHOW VARIABLES LIKE 'innodb_file_per_table';
+-----------------------+-------+
| Variable_name         | Value |
+-----------------------+-------+
| innodb_file_per_table | ON    |
+-----------------------+-------+

mysql> SHOW VARIABLES LIKE 'innodb_page_size';
+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
| innodb_page_size | 16384 |
+------------------+-------+

mysql> CREATE TABLE t1 (c1 int) ROW_FORMAT=DYNAMIC;
Query OK, 0 rows affected (0.02 sec)

mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME LIKE 'test/t1'\G
*************************** 1. row ***************************
        SPACE: 75
         NAME: test/t1
         FLAG: 33
   ROW_FORMAT: Dynamic
    PAGE_SIZE: 16384
ZIP_PAGE_SIZE: 0
1 row in set (0.00 sec)

24.33.25 The INFORMATION_SCHEMA INNODB_TABLESPACES_BRIEF Table

The INNODB_TABLESPACES_BRIEF table provides space ID, name, path, flag, and space type metadata for file-per-table, general, and system tablespaces.

INNODB_TABLESPACES provides the same metadata but loads more slowly because other metadata provided by the table, such as FS_BLOCK_SIZE, FILE_SIZE, and ALLOCATED_SIZE, must be loaded dynamically.

Space and path metadata is also provided by the INNODB_DATAFILES table.

Table 24.27 INNODB_TABLESPACES_BRIEF Columns

Column name Description
SPACE Tablespace Space ID.
NAME The database and table name.
PATH The tablespace data file path. If a file-per-table tablespace is created in a location outside the MySQL data directory, the path value is a fully qualified directory path.
FLAG Bit-level data about tablespace format and storage characteristics.
SPACE_TYPE The type of tablespace. Possible values include General for InnoDB general tablespaces, Single for InnoDB file-per-table tablespaces, and System for the InnoDB system tablespace.

Example:

mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_BRIEF WHERE SPACE = 7;
+-------+---------+---------------+-------+------------+
| SPACE | NAME    | PATH          | FLAG  | SPACE_TYPE |
+-------+---------+---------------+-------+------------+
| 7     | test/t1 | ./test/t1.ibd | 16417 | Single     |
+-------+---------+---------------+-------+------------+

Notes:

  • Use DESCRIBE or SHOW COLUMNS to view additional information about the columns of this table including data types and default values.

  • You must have the PROCESS privilege to query this table.

24.33.26 The INFORMATION_SCHEMA INNODB_TABLESTATS View

The INNODB_TABLESTATS provides a view of low-level status information about InnoDB tables. This data is used by the MySQL optimizer to calculate which index to use when querying an InnoDB table. This information is derived from in-memory data structures rather than corresponding to data stored on disk. There is no corresponding internal InnoDB system table.

InnoDB tables are represented in this view if they have been opened since the last server restart, and not aged out of the table cache. Tables for which persistent stats are available are always represented in this view.

Table statistics are only updated for DELETE or UPDATE operations that modify indexed columns. Statistics are not updated by operations that only modify non-indexed columns.

For related usage information and examples, see Section 15.14.3, “InnoDB INFORMATION_SCHEMA Schema Object Tables”.

Table 24.28 INNODB_TABLESTATS Columns

Column name Description
TABLE_ID An identifier representing the table for which statistics are available, using the same value as INNODB_TABLES.TABLE_ID.
NAME The name of the table, using the same value as INNODB_TABLES.NAME.
STATS_INITIALIZED The value is Initialized if the statistics are already collected, Uninitialized if not.
NUM_ROWS The current estimated number of rows in the table. Updated after each DML operation. Could be imprecise if uncommitted transactions are inserting into or deleting from the table.
CLUST_INDEX_SIZE Number of pages on disk that store the clustered index, which holds the InnoDB table data in primary key order. This value might be null if no statistics are collected yet for the table.
OTHER_INDEX_SIZE Number of pages on disk that store all secondary indexes for the table. This value might be null if no statistics are collected yet for the table.
MODIFIED_COUNTER The number of rows modified by DML operations, such as INSERT, UPDATE, DELETE, and also cascade operations from foreign keys. This column is reset each time table statistics are recalculated
AUTOINC The next number to be issued for any auto-increment-based operation. The rate at which the AUTOINC value changes depends on how many times auto-increment numbers have been requested and how many numbers are granted per request.
REF_COUNT When this counter reaches zero, the table metadata can be evicted from the table cache.

Example:

mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLESTATS where TABLE_ID = 71\G
*************************** 1. row ***************************
         TABLE_ID: 71
             NAME: test/t1
STATS_INITIALIZED: Initialized
         NUM_ROWS: 1
 CLUST_INDEX_SIZE: 1
 OTHER_INDEX_SIZE: 0
 MODIFIED_COUNTER: 1
          AUTOINC: 0
        REF_COUNT: 1

Notes:

  • This table is primarily useful for expert-level performance monitoring, or when developing performance-related extensions for MySQL.

  • Use DESCRIBE or SHOW COLUMNS to view additional information about the columns of this table including data types and default values.

  • You must have the PROCESS privilege to query this table.

24.33.27 The INFORMATION_SCHEMA INNODB_VIRTUAL Table

The INNODB_VIRTUAL table provides metadata about InnoDB virtual generated columns and columns upon which virtual generated columns are based.

A row appears in the INNODB_VIRTUAL table for each column upon which a virtual generated column is based.

Table 24.29 INNODB_VIRTUAL Columns

Column name Description
TABLE_ID An identifier representing the table associated with the virtual column; the same value as INNODB_TABLES.TABLE_ID.
POS The position value of the virtual generated column. The value is large because it encodes the column sequence number and ordinal position. The formula used to calculate the value uses a bitwise operation. The formula is ((nth virtual generated column for the InnoDB instance + 1) << 16) + the ordinal position of the virtual generated column. For example, if the first virtual generated column in the InnoDB instance is the third column of the table, the formula is (0 + 1) << 16) + 2. The first virtual generated column in the InnoDB instance is always number 0. As the third column in the table, the ordinal position of the virtual generated column is 2. Ordinal positions are counted from 0.
BASE_POS The ordinal position of the columns upon which a virtual generated column is based.

Example:

mysql> CREATE TABLE `t1` (
         `a` int(11) DEFAULT NULL,
         `b` int(11) DEFAULT NULL,
         `c` int(11) GENERATED ALWAYS AS (a+b) VIRTUAL,
         `h` varchar(10) DEFAULT NULL
       ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_VIRTUAL
       WHERE TABLE_ID IN (SELECT TABLE_ID FROM INFORMATION_SCHEMA.INNODB_TABLES WHERE NAME LIKE "test/t1");
+----------+-------+----------+
| TABLE_ID | POS   | BASE_POS |
+----------+-------+----------+
|       98 | 65538 |        0 |
|       98 | 65538 |        1 |
+----------+-------+----------+

Notes:

  • If a constant value is assigned to a virtual generated column, as in the following example, an entry for the column does not appear in the INNODB_VIRTUAL table. For an entry to appear, a virtual generated column must have a base column.

    mysql> CREATE TABLE `t1` (
             `a` int(11) DEFAULT NULL,
             `b` int(11) DEFAULT NULL,
             `c` int(11) GENERATED ALWAYS AS (5) VIRTUAL
           ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
    

    However, metadata for such a column appears in the INNODB_COLUMNS table.

  • Use DESCRIBE or SHOW COLUMNS to view additional information about the columns of this table including data types and default values.

  • You must have the PROCESS privilege to query this table.

24.33.28 The INFORMATION_SCHEMA INNODB_TEMP_TABLE_INFO Table

INNODB_TEMP_TABLE_INFO provides information about user-created InnoDB temporary tables that are currently active within the InnoDB instance. It does not provide information about internal InnoDB temporary tables that are used by the optimizer. The INNODB_TEMP_TABLE_INFO table is created when it is first queried and only exists in memory. It is not persisted to disk.

For usage information and examples, see Section 15.14.7, “InnoDB INFORMATION_SCHEMA Temporary Table Info Table”.

Table 24.30 INNODB_TEMP_TABLE_INFO Columns

Column name Description
TABLE_ID The table ID of the active temporary table.
NAME The name of the active temporary table.
N_COLS The number of columns in the temporary table. The number always includes three hidden columns created by InnoDB (DB_ROW_ID, DB_TRX_ID, and DB_ROLL_PTR).
SPACE The tablespace identifier (a numerical value) for the tablespace where the temporary table resides. All InnoDB temporary tables reside in a shared temporary tablespace. The data file for the shared temporary tablespace is defined by the innodb_temp_data_file_path configuration option. By default, there is a single data file for the shared temporary tablespace named ibtmp1, which is located in the data directory. The SPACE ID for the temporary tablespace is always a nonzero value and is dynamically generated on server restart.

Example:

mysql> CREATE TEMPORARY TABLE t1 (c1 INT PRIMARY KEY) ENGINE=INNODB;
Query OK, 0 rows affected (0.01 sec)

mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_TEMP_TABLE_INFO\G
*************************** 1. row ***************************
TABLE_ID: 97
    NAME: #sql8c88_43_0
  N_COLS: 4
   SPACE: 76
1 row in set (0.00 sec)

Notes:

  • This table is primarily useful for expert level monitoring.

  • Use DESCRIBE or SHOW COLUMNS to view additional information about the columns of this table including data types and default values.

  • You must have the PROCESS privilege to query this table.

24.33.29 The INFORMATION_SCHEMA INNODB_TRX Table

The INNODB_TRX table contains information about every transaction (excluding read-only transactions) currently executing inside InnoDB, including whether the transaction is waiting for a lock, when the transaction started, and the SQL statement the transaction is executing, if any.

Table 24.31 INNODB_TRX Columns

Column name Description
TRX_ID Unique transaction ID number, internal to InnoDB. These IDs are not created for transactions that are read only and nonlocking. See Section 8.5.3, “Optimizing InnoDB Read-Only Transactions” for details.
TRX_WEIGHT The weight of a transaction, reflecting (but not necessarily the exact count of) the number of rows altered and the number of rows locked by the transaction. To resolve a deadlock, InnoDB selects the transaction with the smallest weight as the victim to roll back. Transactions that have changed non-transactional tables are considered heavier than others, regardless of the number of altered and locked rows.
TRX_STATE Transaction execution state. Permitted values are RUNNING, LOCK WAIT, ROLLING BACK, and COMMITTING.
TRX_STARTED Transaction start time.
TRX_REQUESTED_LOCK_ID ID of the lock the transaction is currently waiting for, if TRX_STATE is LOCK WAIT; otherwise NULL. To obtain details about the lock, join this column with the ENGINE_LOCK_ID column of the Performance Schema data_locks table.
TRX_WAIT_STARTED Time when the transaction started waiting on the lock, if TRX_STATE is LOCK WAIT; otherwise NULL.
TRX_MYSQL_THREAD_ID MySQL thread ID. To obtain details about the thread, join this column with the ID column of the PROCESSLIST table, but see Section 15.14.2.3, “Persistence and Consistency of InnoDB Transaction and Locking Information”.
TRX_QUERY The SQL statement that is being executed by the transaction.
TRX_OPERATION_STATE The transaction's current operation, if any; otherwise NULL.
TRX_TABLES_IN_USE The number of InnoDB tables used while processing the current SQL statement of this transaction.
TRX_TABLES_LOCKED Number of InnoDB tables that the current SQL statement has row locks on. (Because these are row locks, not table locks, the tables can usually still be read from and written to by multiple transactions, despite some rows being locked.)
TRX_LOCK_STRUCTS The number of locks reserved by the transaction.
TRX_LOCK_MEMORY_BYTES Total size taken up by the lock structures of this transaction in memory.
TRX_ROWS_LOCKED Approximate number or rows locked by this transaction. The value might include delete-marked rows that are physically present but not visible to the transaction.
TRX_ROWS_MODIFIED The number of modified and inserted rows in this transaction.
TRX_CONCURRENCY_TICKETS A value indicating how much work the current transaction can do before being swapped out, as specified by the innodb_concurrency_tickets system variable.
TRX_ISOLATION_LEVEL The isolation level of the current transaction.
TRX_UNIQUE_CHECKS Whether unique checks are turned on or off for the current transaction. For example, they might be turned off during a bulk data load.
TRX_FOREIGN_KEY_CHECKS Whether foreign key checks are turned on or off for the current transaction. For example, they might be turned off during a bulk data load.
TRX_LAST_FOREIGN_KEY_ERROR Detailed error message for the last foreign key error, if any; otherwise NULL.
TRX_ADAPTIVE_HASH_LATCHED Whether the adaptive hash index is locked by the current transaction. When the adaptive hash index search system is partitioned, a single transaction does not lock the entire adaptive hash index. Adaptive hash index partitioning is controlled by innodb_adaptive_hash_index_parts, which is set to 8 by default.
TRX_ADAPTIVE_HASH_TIMEOUT Whether to relinquish the search latch immediately for the adaptive hash index, or reserve it across calls from MySQL. When there is no adaptive hash index contention, this value remains zero and statements reserve the latch until they finish. During times of contention, it counts down to zero, and statements release the latch immediately after each row lookup. When the adaptive hash index search system is partitioned (controlled by innodb_adaptive_hash_index_parts), the value remains 0.
TRX_IS_READ_ONLY A value of 1 indicates the transaction is read only.
TRX_AUTOCOMMIT_NON_LOCKING A value of 1 indicates the transaction is a SELECT statement that does not use the FOR UPDATE or LOCK IN SHARED MODE clauses, and is executing with autocommit enabled so that the transaction will only contain this one statement. When this column and TRX_IS_READ_ONLY are both 1, InnoDB optimizes the transaction to reduce the overhead associated with transactions that change table data.

Example:

mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_TRX\G
*************************** 1. row ***************************
                    trx_id: 1510
                 trx_state: RUNNING
               trx_started: 2014-11-19 13:24:40
     trx_requested_lock_id: NULL
          trx_wait_started: NULL
                trx_weight: 586739
       trx_mysql_thread_id: 2
                 trx_query: DELETE FROM employees.salaries WHERE salary > 65000
       trx_operation_state: updating or deleting
         trx_tables_in_use: 1
         trx_tables_locked: 1
          trx_lock_structs: 3003
     trx_lock_memory_bytes: 450768
           trx_rows_locked: 1407513
         trx_rows_modified: 583736
   trx_concurrency_tickets: 0
       trx_isolation_level: REPEATABLE READ
         trx_unique_checks: 1
    trx_foreign_key_checks: 1
trx_last_foreign_key_error: NULL
 trx_adaptive_hash_latched: 0
 trx_adaptive_hash_timeout: 10000
          trx_is_read_only: 0
trx_autocommit_non_locking: 0

Notes:

24.34 Thread Pool INFORMATION_SCHEMA Tables

The following sections describe the INFORMATION_SCHEMA tables associated with the thread pool plugin. They provide information about thread pool operation:

Rows in these tables represent snapshots in time. In the case of TP_THREAD_STATE, all rows for a thread group comprise a snapshot in time. Thus, the MySQL server holds the mutex of the thread group while producing the snapshot. But it does not hold mutexes on all thread groups at the same time, to prevent a statement against TP_THREAD_STATE from blocking the entire MySQL server.

The thread pool INFORMATION_SCHEMA tables are implemented by individual plugins and the decision whether to load one can be made independently of the others (see Section 5.6.3.2, “Thread Pool Installation”). However, the content of all the tables depends on the thread pool plugin being enabled. If a table plugin is enabled but the thread pool plugin is not, the table becomes visible and can be accessed but will be empty.

24.34.1 The INFORMATION_SCHEMA TP_THREAD_GROUP_STATE Table

This table has one row per thread group in the thread pool. Each row provides information about the current state of a group. The table has these columns:

  • TP_GROUP_ID

    The thread group ID. This is a unique key within the table.

  • CONSUMER THREADS

    The number of consumer threads. There is at most one thread ready to start executing if the active threads become stalled or blocked.

  • RESERVE_THREADS

    The number of threads in the reserved state. This means that they will not be started until there is a need to wake a new thread and there is no consumer thread. This is where most threads end up when the thread group has created more threads than needed for normal operation. Often a thread group needs additional threads for a short while and then does not need them again for a while. In this case, they go into the reserved state and remain until needed again. They take up some extra memory resources, but no extra computing resources.

  • CONNECT_THREAD_COUNT

    The number of threads that are processing or waiting to process connection initialization and authentication. There can be a maximum of four connection threads per thread group; these threads expire after a period of inactivity.

    This column was added in MySQL 5.7.18.

  • CONNECTION_COUNT

    The number of connections using this thread group.

  • QUEUED_QUERIES

    The number of statements waiting in the high-priority queue.

  • QUEUED_TRANSACTIONS

    The number of statements waiting in the low-priority queue. These are the initial statements for transactions that have not started, so they also represent queued transactions.

  • STALL_LIMIT

    The value of the thread_pool_stall_limit variable on the thread group. This is the same value for all thread groups.

  • PRIO_KICKUP_TIMER

    The value of the thread_pool_prio_kickup_timer on the thread group. This is the same value for all thread groups.

  • ALGORITHM

    The value of the thread_pool_algorithm on the thread group. This is the same value for all thread groups.

  • THREAD_COUNT

    The number of threads started in the thread pool as part of this thread group.

  • ACTIVE_THREAD_COUNT

    The number of threads active executing statements.

  • MAX_THREAD_IDS_IN_GROUP

    The maximum thread ID of the threads in the group. This is the same as MAX(TP_THREAD_NUMBER) for the threads when selected from the TP_THREAD_GROUP_STATE table. That is, these two queries are equivalent:

    SELECT TP_GROUP_ID, MAX_THREAD_IDS_IN_GROUP
    FROM TP_THREAD_GROUP_STATE;
    
    SELECT TP_GROUP_ID, MAX(TP_THREAD_NUMBER)
    FROM TP_THREAD_STATE GROUP BY TP_GROUP_ID;
    
  • STALLED_THREAD_COUNT

    The number of stalled statements in the thread group. A stalled statement could be executing, but from a thread pool perspective it is stalled and making no progress. A long-running statement quickly ends up in this category.

  • WAITING_THREAD_NUMBER

    If there is a thread handling the polling of statements in the thread group, this specifies the thread number within this thread group. It is possible that this thread could be executing a statement.

  • OLDEST_QUEUED

    How long in milliseconds the oldest queued statement has been waiting for execution.

24.34.2 The INFORMATION_SCHEMA TP_THREAD_GROUP_STATS Table

This table reports statistics per thread group. There is one row per group. The table has these columns:

  • TP_GROUP_ID

    The thread group ID. This is a unique key within the table.

  • CONNECTIONS_STARTED

    The number of connections started.

  • CONNECTIONS_CLOSED

    The number of connections closed.

  • QUERIES_EXECUTED

    The number of statements executed. This number is incremented when a statement starts executing, not when it finishes.

  • QUERIES_QUEUED

    The number of statements received that were queued for execution. This does not count statements that the thread group was able to begin executing immediately without queuing, which can happen under the conditions described in Section 5.6.3.3, “Thread Pool Operation”.

  • THREADS_STARTED

    The number of threads started.

  • PRIO_KICKUPS

    The number of statements that have been moved from low-priority queue to high-priority queue based on the value of the thread_pool_prio_kickup_timer system variable. If this number increases quickly, consider increasing the value of that variable. A quickly increasing counter means that the priority system is not keeping transactions from starting too early. For InnoDB, this most likely means deteriorating performance due to too many concurrent transactions..

  • STALLED_QUERIES_EXECUTED

    The number of statements that have become defined as stalled due to executing for a time longer than the value of the thread_pool_stall_limit system variable.

  • BECOME_CONSUMER_THREAD

    The number of times thread have been assigned the consumer thread role.

  • BECOME_RESERVE_THREAD

    The number of times threads have been assigned the reserve thread role.

  • BECOME_WAITING_THREAD

    The number of times threads have been assigned the waiter thread role. When statements are queued, this happens very often, even in normal operation, so rapid increases in this value are normal in the case of a highly loaded system where statements are queued up.

  • WAKE_THREAD_STALL_CHECKER

    The number of times the stall check thread decided to wake or create a thread to possibly handle some statements or take care of the waiter thread role.

  • SLEEP_WAITS

    The number of THD_WAIT_SLEEP waits. These occur when threads go to sleep; for example, by calling the SLEEP() function.

  • DISK_IO_WAITS

    The number of THD_WAIT_DISKIO waits. These occur when threads perform disk I/O that is likely to not hit the file system cache. Such waits occur when the buffer pool reads and writes data to disk, not for normal reads from and writes to files.

  • ROW_LOCK_WAITS

    The number of THD_WAIT_ROW_LOCK waits for release of a row lock by another transaction.

  • GLOBAL_LOCK_WAITS

    The number of THD_WAIT_GLOBAL_LOCK waits for a global lock to be released.

  • META_DATA_LOCK_WAITS

    The number of THD_WAIT_META_DATA_LOCK waits for a metadata lock to be released.

  • TABLE_LOCK_WAITS

    The number of THD_WAIT_TABLE_LOCK waits for a table to be unlocked that the statement needs to access.

  • USER_LOCK_WAITS

    The number of THD_WAIT_USER_LOCK waits for a special lock constructed by the user thread.

  • BINLOG_WAITS

    The number of THD_WAIT_BINLOG_WAITS waits for the binary log to become free.

  • GROUP_COMMIT_WAITS

    The number of THD_WAIT_GROUP_COMMIT waits. These occur when a group commit must wait for the other parties to complete their part of a transaction.

  • FSYNC_WAITS

    The number of THD_WAIT_SYNC waits for a file sync operation.

24.34.3 The INFORMATION_SCHEMA TP_THREAD_STATE Table

This table has one row per thread created by the thread pool to handle connections. The table has these columns:

  • TP_GROUP_ID

    The thread group ID.

  • TP_THREAD_NUMBER

    The ID of the thread within its thread group. TP_GROUP_ID and TP_THREAD_NUMBER together provide a unique key within the table.

  • PROCESS_COUNT

    The 10ms interval in which the statement that uses this thread is currently executing. 0 means no statement is executing, 1 means it is in the first 10ms, and so forth.

  • WAIT_TYPE

    The type of wait for the thread. NULL means the thread is not blocked. Otherwise, the thread is blocked by a call to thd_wait_begin() and the value specifies the type of wait. The xxx_WAIT columns of the TP_THREAD_GROUP_STATS table accumulate counts for each wait type.

    The WAIT_TYPE value is a string that describes the type of wait, as shown in the following table.

    Table 24.32 WAIT_TYPE Values

    Wait Type Meaning
    THD_WAIT_SLEEP Waiting for sleep
    THD_WAIT_DISKIO Waiting for Disk IO
    THD_WAIT_ROW_LOCK Waiting for row lock
    THD_WAIT_GLOBAL_LOCK Waiting for global lock
    THD_WAIT_META_DATA_LOCK Waiting for metadata lock
    THD_WAIT_TABLE_LOCK Waiting for table lock
    THD_WAIT_USER_LOCK Waiting for user lock
    THD_WAIT_BINLOG Waiting for binlog
    THD_WAIT_GROUP_COMMIT Waiting for group commit
    THD_WAIT_SYNC Waiting for fsync

24.35 Connection-Control INFORMATION_SCHEMA Tables

The following sections describe the INFORMATION_SCHEMA tables associated with the CONNECTION_CONTROL plugin.

24.35.1 The INFORMATION_SCHEMA CONNECTION_CONTROL_FAILED_LOGIN_ATTEMPTS Table

This table provides information about the current number of consecutive failed connection attempts per client user/host combination.

CONNECTION_CONTROL_FAILED_LOGIN_ATTEMPTS has these columns:

  • USERHOST

    The user/host combination of a client that has failed connection attempts, in 'user_name'@'host_name' format.

  • FAILED_ATTEMPTS

    The current number of consecutive failed connection attempts for the USERHOST value. This counts all failed attempts, regardless of whether they were delayed. The number of attempts for which the server added a delay to its response is the difference between the FAILED_ATTEMPTS value and the connection_control_failed_connections_threshold system variable value.

Notes:

  • The CONNECTION_CONTROL_FAILED_LOGIN_ATTEMPTS plugin must be activated for this table to be available, and the CONNECTION_CONTROL plugin must be activated or the table contents will always be empty. See Section 6.5.2, “The Connection-Control Plugins”.

  • The table contains rows only for clients that have had one or more consecutive failed connection attempts without a subsequent successful attempt. When a client connects successfully, its failed-connection count is reset to zero and the server removes any row corresponding to the client.

  • Assigning a value to the connection_control_failed_connections_threshold system variable at runtime resets all accumulated failed-connection counters to zero, which causes the table to become empty.

24.36 Extensions to SHOW Statements

Some extensions to SHOW statements accompany the implementation of INFORMATION_SCHEMA:

  • SHOW can be used to get information about the structure of INFORMATION_SCHEMA itself.

  • Several SHOW statements accept a WHERE clause that provides more flexibility in specifying which rows to display.

INFORMATION_SCHEMA is an information database, so its name is included in the output from SHOW DATABASES. Similarly, SHOW TABLES can be used with INFORMATION_SCHEMA to obtain a list of its tables:

mysql> SHOW TABLES FROM INFORMATION_SCHEMA;
+---------------------------------------+
| Tables_in_INFORMATION_SCHEMA          |
+---------------------------------------+
| CHARACTER_SETS                        |
| COLLATIONS                            |
| COLLATION_CHARACTER_SET_APPLICABILITY |
| COLUMNS                               |
| COLUMN_PRIVILEGES                     |
| ENGINES                               |
| EVENTS                                |
| FILES                                 |
| KEY_COLUMN_USAGE                      |
| PARTITIONS                            |
| PLUGINS                               |
| PROCESSLIST                           |
| REFERENTIAL_CONSTRAINTS               |
| ROUTINES                              |
| SCHEMATA                              |
| SCHEMA_PRIVILEGES                     |
| STATISTICS                            |
| TABLES                                |
| TABLE_CONSTRAINTS                     |
| TABLE_PRIVILEGES                      |
| TRIGGERS                              |
| USER_PRIVILEGES                       |
| VIEWS                                 |
+---------------------------------------+

SHOW COLUMNS and DESCRIBE can display information about the columns in individual INFORMATION_SCHEMA tables.

SHOW statements that accept a LIKE clause to limit the rows displayed also permit a WHERE clause that specifies more general conditions that selected rows must satisfy:

SHOW CHARACTER SET
SHOW COLLATION
SHOW COLUMNS
SHOW DATABASES
SHOW FUNCTION STATUS
SHOW INDEX
SHOW OPEN TABLES
SHOW PROCEDURE STATUS
SHOW STATUS
SHOW TABLE STATUS
SHOW TABLES
SHOW TRIGGERS
SHOW VARIABLES

The WHERE clause, if present, is evaluated against the column names displayed by the SHOW statement. For example, the SHOW CHARACTER SET statement produces these output columns:

mysql> SHOW CHARACTER SET;
+----------+-----------------------------+---------------------+--------+
| Charset  | Description                 | Default collation   | Maxlen |
+----------+-----------------------------+---------------------+--------+
| big5     | Big5 Traditional Chinese    | big5_chinese_ci     |      2 |
| dec8     | DEC West European           | dec8_swedish_ci     |      1 |
| cp850    | DOS West European           | cp850_general_ci    |      1 |
| hp8      | HP West European            | hp8_english_ci      |      1 |
| koi8r    | KOI8-R Relcom Russian       | koi8r_general_ci    |      1 |
| latin1   | cp1252 West European        | latin1_swedish_ci   |      1 |
| latin2   | ISO 8859-2 Central European | latin2_general_ci   |      1 |
...

To use a WHERE clause with SHOW CHARACTER SET, you would refer to those column names. As an example, the following statement displays information about character sets for which the default collation contains the string 'japanese':

mysql> SHOW CHARACTER SET WHERE `Default collation` LIKE '%japanese%';
+---------+---------------------------+---------------------+--------+
| Charset | Description               | Default collation   | Maxlen |
+---------+---------------------------+---------------------+--------+
| ujis    | EUC-JP Japanese           | ujis_japanese_ci    |      3 |
| sjis    | Shift-JIS Japanese        | sjis_japanese_ci    |      2 |
| cp932   | SJIS for Windows Japanese | cp932_japanese_ci   |      2 |
| eucjpms | UJIS for Windows Japanese | eucjpms_japanese_ci |      3 |
+---------+---------------------------+---------------------+--------+

This statement displays the multibyte character sets:

mysql> SHOW CHARACTER SET WHERE Maxlen > 1;
+---------+---------------------------+---------------------+--------+
| Charset | Description               | Default collation   | Maxlen |
+---------+---------------------------+---------------------+--------+
| big5    | Big5 Traditional Chinese  | big5_chinese_ci     |      2 |
| ujis    | EUC-JP Japanese           | ujis_japanese_ci    |      3 |
| sjis    | Shift-JIS Japanese        | sjis_japanese_ci    |      2 |
| euckr   | EUC-KR Korean             | euckr_korean_ci     |      2 |
| gb2312  | GB2312 Simplified Chinese | gb2312_chinese_ci   |      2 |
| gbk     | GBK Simplified Chinese    | gbk_chinese_ci      |      2 |
| utf8    | UTF-8 Unicode             | utf8_general_ci     |      3 |
| ucs2    | UCS-2 Unicode             | ucs2_general_ci     |      2 |
| cp932   | SJIS for Windows Japanese | cp932_japanese_ci   |      2 |
| eucjpms | UJIS for Windows Japanese | eucjpms_japanese_ci |      3 |
+---------+---------------------------+---------------------+--------+