Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions information-schema/information-schema-partitions.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ summary: Learn the `PARTITIONS` INFORMATION_SCHEMA table.

The `PARTITIONS` table provides information about [partitioned tables](/partitioned-table.md).

> **Note:**
>
> Computing `AVG_ROW_LENGTH`, `DATA_LENGTH`, or `INDEX_LENGTH` requires TiDB to read per-column size statistics from the `mysql.stats_histograms` system table, which holds one row for each column of every table. On clusters with a large number of tables, selecting any of these columns can consume noticeably more time and resources than selecting only `TABLE_ROWS`, which reads only the smaller `mysql.stats_meta` system table. If you need only the estimated row count, select `TABLE_ROWS` without the size columns to avoid this overhead.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
> Computing `AVG_ROW_LENGTH`, `DATA_LENGTH`, or `INDEX_LENGTH` requires TiDB to read per-column size statistics from the `mysql.stats_histograms` system table, which holds one row for each column of every table. On clusters with a large number of tables, selecting any of these columns can consume noticeably more time and resources than selecting only `TABLE_ROWS`, which reads only the smaller `mysql.stats_meta` system table. If you need only the estimated row count, select `TABLE_ROWS` without the size columns to avoid this overhead.
> Querying `AVG_ROW_LENGTH`, `DATA_LENGTH`, or `INDEX_LENGTH` requires TiDB to read column-size statistics from `mysql.stats_histograms`. On clusters with a large number of tables, selecting any of these columns can consume more time and resources than selecting only `TABLE_ROWS`, which only requires row-count statistics from `mysql.stats_meta`. If you need only the estimated row count, select `TABLE_ROWS` without the size columns to avoid this overhead.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reason: to focus on the user-visible performance impact. The exact layout of mysql.stats_histograms is an implementation detail, and saying it holds one row for each column of every table is too absolute because the table also stores index statistics.


```sql
USE INFORMATION_SCHEMA;
DESC partitions;
Expand Down
4 changes: 4 additions & 0 deletions information-schema/information-schema-tables.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ The description of columns in the `TABLES` table is as follows:
* `CREATE_OPTIONS`: Creates options.
* `TABLE_COMMENT`: The comments and notes of the table.

> **Note:**
>
> Computing `AVG_ROW_LENGTH`, `DATA_LENGTH`, or `INDEX_LENGTH` requires TiDB to read per-column size statistics from the `mysql.stats_histograms` system table, which holds one row for each column of every table. On clusters with a large number of tables, selecting any of these columns can consume noticeably more time and resources than selecting only `TABLE_ROWS`, which reads only the smaller `mysql.stats_meta` system table. If you need only the estimated row count, select `TABLE_ROWS` without the size columns to avoid this overhead.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
> Computing `AVG_ROW_LENGTH`, `DATA_LENGTH`, or `INDEX_LENGTH` requires TiDB to read per-column size statistics from the `mysql.stats_histograms` system table, which holds one row for each column of every table. On clusters with a large number of tables, selecting any of these columns can consume noticeably more time and resources than selecting only `TABLE_ROWS`, which reads only the smaller `mysql.stats_meta` system table. If you need only the estimated row count, select `TABLE_ROWS` without the size columns to avoid this overhead.
> Querying `AVG_ROW_LENGTH`, `DATA_LENGTH`, or `INDEX_LENGTH` requires TiDB to read column-size statistics from `mysql.stats_histograms`. On clusters with a large number of tables, selecting any of these columns can consume more time and resources than selecting only `TABLE_ROWS`, which only requires row-count statistics from `mysql.stats_meta`. If you need only the estimated row count, select `TABLE_ROWS` without the size columns to avoid this overhead.


Most of the information in the table is the same as MySQL. The following columns are newly defined by TiDB:

* `TIDB_TABLE_ID`: to indicate the internal ID of a table. This ID is unique in a TiDB cluster.
Expand Down