# mysql.index\_stats Table

The `mysql.index_stats` table is one of three tables storing data used for [Engine-independent table statistics](https://mariadb.com/docs/server/ha-and-performance/optimization-and-tuning/query-optimizations/statistics-for-optimizing-queries/engine-independent-table-statistics). The others are [mysql.column\_stats](https://mariadb.com/docs/server/reference/system-tables/the-mysql-database-tables/mysql-column_stats-table) and [mysql.table\_stats](https://mariadb.com/docs/server/reference/system-tables/the-mysql-database-tables/mysql-table_stats-table).

It is populated when the [ANALYZE TABLE](https://mariadb.com/docs/server/reference/sql-statements/table-statements/analyze-table) statement is run, although not by default. See [Collecting Statistics with the ANALYZE TABLE Statement](https://mariadb.com/docs/server/ha-and-performance/optimization-and-tuning/query-optimizations/statistics-for-optimizing-queries/engine-independent-table-statistics#collecting-statistics-with-the-analyze-table-statement) for details.

It is possible to manually update the table and, unlike most system tables, there are some scenarios where this could be useful. See [Manual updates to statistics tables](https://mariadb.com/docs/server/ha-and-performance/optimization-and-tuning/query-optimizations/statistics-for-optimizing-queries/engine-independent-table-statistics#manual-updates-to-statistics-tables) for details.

This table uses the [Aria](https://mariadb.com/docs/server/server-usage/storage-engines/aria) storage engine.

The `mysql.index_stats` table contains the following fields:

| Field          | Type             | Null | Key | Default | Description                                                                                                                           |
| -------------- | ---------------- | ---- | --- | ------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| db\_name       | varchar(64)      | NO   | PRI | NULL    | Database the table is in.                                                                                                             |
| table\_name    | varchar(64)      | NO   | PRI | NULL    | Table name                                                                                                                            |
| index\_name    | varchar(64)      | NO   | PRI | NULL    | Name of the index                                                                                                                     |
| prefix\_arity  | int(11) unsigned | NO   | PRI | NULL    | Index prefix length. 1 for the first keypart, 2 for the first two, and so on. InnoDB's extended keys are supported.                   |
| avg\_frequency | decimal(12,4)    | YES  |     | NULL    | Average number of records one will find for given values of (keypart1, keypart2, ..), provided the values will be found in the table. |

It is possible to manually update the table. See [Manual updates to statistics tables](https://mariadb.com/docs/server/ha-and-performance/optimization-and-tuning/query-optimizations/statistics-for-optimizing-queries/engine-independent-table-statistics#manual-updates-to-statistics-tables) for details.

<sub>*This page is licensed: CC BY-SA / Gnu FDL*</sub>

{% @marketo/form formId="4316" %}
