Complete SHOW INDEX reference: SHOW {INDEX|INDEXES|KEYS} FROM tbl_name syntax, output fields (Key_name, Seq_in_index, Cardinality), and WHERE/LIKE filters.
Syntax
SHOW {INDEX | INDEXES | KEYS} FROM tbl_name [FROM db_name] [WHERE expr]
Description
SHOW INDEX returns table index information. The format resembles that of the SQLStatistics call in ODBC.
You can use db_name.tbl_name as an alternative to thetbl_name FROM db_name syntax. These two statements are equivalent:
SHOW INDEXFROM mytable FROM mydb;SHOW INDEXFROM mydb.mytable;
SHOW KEYS and SHOW INDEXES are synonyms for SHOW INDEX.
You can also list a table's indexes with the mariadb-show command:
1 if the index permits duplicate values, 0 if values must be unique.
Key_name
Index name. The primary key is always named PRIMARY.
Seq_in_index
The column's sequence in the index, beginning with 1.
Column_name
Column name.
Collation
Either A, if the column is sorted in ascending order in the index, or NULL if it's not sorted.
Cardinality
Estimated number of unique values in the index. The cardinality statistics are calculated at various times, and can help the optimizer make improved decisions.
Sub_part
NULL if the entire column is included in the index, or the number of included characters if not.
Packed
NULL if the index is not packed, otherwise how the index is packed.
Null
NULL if NULL values are permitted in the column, an empty string if NULLs are not permitted.