# mysql.table\_stats Table

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

It is populated when the [ANALYZE TABLE](/docs/server/reference/sql-statements/table-statements/analyze-table.md) statement is run, although not by default. See [Collecting Statistics with the ANALYZE TABLE Statement](/docs/server/ha-and-performance/optimization-and-tuning/query-optimizations/statistics-for-optimizing-queries/engine-independent-table-statistics.md#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](/docs/server/ha-and-performance/optimization-and-tuning/query-optimizations/statistics-for-optimizing-queries/engine-independent-table-statistics.md#manual-updates-to-statistics-tables) for details.

This table uses the [Aria](/docs/server/server-usage/storage-engines/aria.md) storage engine.

The `mysql.table_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.                     |
| cardinality | bigint(21) unsigned | YES  |     | NULL    | Number of records in the table. |

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

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mariadb.com/docs/server/reference/system-tables/the-mysql-database-tables/mysql-table_stats-table.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
