Information Schema TABLES Table
The Information Schema TABLES table provides metadata about tables in databases, including row counts, storage engines, and creation times.
The Information Schema table shows information about the various tables and views on the server.
The Information Schema table shows information about the various tables, excludingTEMPORARY tables, except for tables from the Information Schema database) and views on the server.
It contains the following columns:
TABLE_CATALOG
Always def.
TABLE_SCHEMA
Database name.
TABLE_NAME
Table name.
TABLE_TYPE
One of BASE TABLE for a regular table, VIEW for a view, SYSTEM VIEW for Information Schema tables, SYSTEM VERSIONED for system-versioned tables, SEQUENCE for sequences or TEMPORARY for local temporary tables.
ENGINE
VERSION
Version number from the table's .frm file
TABLE_ROWS
Number of rows in the table. Some engines, such as XtraDB and InnoDB may store an estimate.
AVG_ROW_LENGTH
Average row length in the table.
DATA_LENGTH
For InnoDB/XtraDB, the index size, in pages, multiplied by the page size. For Aria and MyISAM, length of the data file, in bytes. For MEMORY, the approximate allocated memory.
MAX_DATA_LENGTH
Maximum length of the data file, ie the total number of bytes that could be stored in the table. Not used in XtraDB and InnoDB.
INDEX_LENGTH
Length of the index file.
DATA_FREE
Bytes allocated but unused. For InnoDB tables in a shared tablespace, the free space of the shared tablespace with small safety margin. An estimate in the case of partitioned tables - see the PARTITIONS table.
AUTO_INCREMENT
Next AUTO_INCREMENT value.
CREATE_TIME
Time the table was created. Some engines just return the ctime information from the file system layer here, in that case the value is not necessarily the table creation time but rather the time the file system metadata for it had last changed.
UPDATE_TIME
Time the table was last updated. On Windows, the timestamp is not updated on update, so MyISAM values will be inaccurate. In InnoDB, if shared tablespaces are used, will be NULL, while buffering can also delay the update, so the value will differ from the actual time of the last UPDATE, INSERT or DELETE.
CHECK_TIME
Time the table was last checked. Not kept by all storage engines, in which case will be NULL.
TABLE_COLLATION
CHECKSUM
Live checksum value, if any.
CREATE_OPTIONS
Extra CREATE TABLE options.
TABLE_COMMENT
Table comment provided when MariaDB created the table.
MAX_INDEX_LENGTH
Maximum index length (supported by MyISAM and Aria tables).
TEMPORARY
Is set to "Y" for local temporary tables.
Although the table is standard in the Information Schema, all but TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, ENGINE and VERSION are MySQL and MariaDB extensions.
SHOW TABLES lists all tables in a database.
Examples
Example with temporary = 'y':
View Tables in Order of Size
Returns a list of all tables in the database, ordered by size:
Returns information about a temporary table:
See Also
This page is licensed: CC BY-SA / Gnu FDL
Last updated
Was this helpful?

