The INFORMATION_SCHEMA.STATISTICS Table : INFORMATION_SCHEMA « Data Dictionary « MySQL Tutorial






The STATISTICS table provides information about table indexes.

mysql> desc INFORMATION_SCHEMA.STATISTICS;
+---------------+--------------+------+-----+---------+-------+
| Field         | Type         | Null | Key | Default | Extra |
+---------------+--------------+------+-----+---------+-------+
| TABLE_CATALOG | varchar(512) | YES  |     | NULL    |       |
| TABLE_SCHEMA  | varchar(64)  | NO   |     |         |       |
| TABLE_NAME    | varchar(64)  | NO   |     |         |       |
| NON_UNIQUE    | bigint(1)    | NO   |     | 0       |       |
| INDEX_SCHEMA  | varchar(64)  | NO   |     |         |       |
| INDEX_NAME    | varchar(64)  | NO   |     |         |       |
| SEQ_IN_INDEX  | bigint(2)    | NO   |     | 0       |       |
| COLUMN_NAME   | varchar(64)  | NO   |     |         |       |
| COLLATION     | varchar(1)   | YES  |     | NULL    |       |
| CARDINALITY   | bigint(21)   | YES  |     | NULL    |       |
| SUB_PART      | bigint(3)    | YES  |     | NULL    |       |
| PACKED        | varchar(10)  | YES  |     | NULL    |       |
| NULLABLE      | varchar(3)   | NO   |     |         |       |
| INDEX_TYPE    | varchar(16)  | NO   |     |         |       |
| COMMENT       | varchar(16)  | YES  |     | NULL    |       |
+---------------+--------------+------+-----+---------+-------+
15 rows in set (0.02 sec)

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]








25.8.INFORMATION_SCHEMA
25.8.1.The INFORMATION_SCHEMA Database
25.8.2.The INFORMATION_SCHEMA.SCHEMATA Table
25.8.3.The INFORMATION_SCHEMA.TABLES Table
25.8.4.The INFORMATION_SCHEMA.COLUMNS Table
25.8.5.The INFORMATION_SCHEMA.STATISTICS Table
25.8.6.The INFORMATION_SCHEMA.USER_PRIVILEGES Table
25.8.7.The INFORMATION_SCHEMA.SCHEMA_PRIVILEGES Table
25.8.8.The INFORMATION_SCHEMA.TABLE_PRIVILEGES Table
25.8.9.The INFORMATION_SCHEMA.COLUMN_PRIVILEGES Table
25.8.10.The INFORMATION_SCHEMA.CHARACTER_SETS Table
25.8.11.The INFORMATION_SCHEMA.COLLATIONS Table
25.8.12.The INFORMATION_SCHEMA.COLLATION_CHARACTER_SET_APPLICABILITY Table
25.8.13.The INFORMATION_SCHEMA.TABLE_CONSTRAINTS Table
25.8.14.The INFORMATION_SCHEMA KEY_COLUMN_USAGE Table
25.8.15.The INFORMATION_SCHEMA ROUTINES Table
25.8.16.The INFORMATION_SCHEMA.VIEWS Table
25.8.17.The INFORMATION_SCHEMA.TRIGGERS Table
25.8.18.The INFORMATION_SCHEMA.PROFILING Table