This is a read-only copy of the MariaDB Knowledgebase generated on 2024-11-14. For the latest, interactive version please visit https://mariadb.com/kb/.

Information Schema INDEX_STATISTICS Table

The Information Schema INDEX_STATISTICS table shows statistics on index usage and makes it possible to do such things as locating unused indexes and generating the commands to remove them.

This is part of the User Statistics feature, which is not enabled by default.

It contains the following columns:

FieldTypeNotes
TABLE_SCHEMAVARCHAR(192)The schema (database) name.
TABLE_NAMEVARCHAR(192)The table name.
INDEX_NAMEVARCHAR(192)The index name (as visible in SHOW CREATE TABLE).
ROWS_READBIGINT(21)The number of rows read from this index.
QUERIESBIGINT(21)Incremented for each index the query is part of. This assists one to see how effective the index is. From MariaDB 11.5

Example

SELECT * FROM information_schema.INDEX_STATISTICS 
WHERE TABLE_NAME = "author";
+--------------+------------+------------+-----------+
| TABLE_SCHEMA | TABLE_NAME | INDEX_NAME | ROWS_READ |
+--------------+------------+------------+-----------+
| books        | author     | by_name    |        15 |
+--------------+------------+------------+-----------+
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.