Skip to content

system tables: add a note for DATA_LENGTH, INDEX_LENGTH, and TABLE_SIZE #19391

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@ Fields in the `TABLE_STORAGE_STATS` table are described as follows:
* `PEER_COUNT`: The number of replicas of the table.
* `REGION_COUNT`: The number of Regions.
* `EMPTY_REGION_COUNT`: The number of Regions that do not contain data in this table.
* `TABLE_SIZE`: The total size of the table, in the unit of MiB.
* `TABLE_SIZE`: The total size of the table, in the unit of MiB. Note that this value is a logical estimate based on table statistics and does not represent the actual compressed physical size in storage.
Copy link
Contributor

Choose a reason for hiding this comment

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

The fact that this is based on statistics is good. However that it doesn't represent the "actual compressed physical size in storage" is not because the statistics aren't precise enough. This is because the size in storage and is measuring something different.

Copy link
Contributor

Choose a reason for hiding this comment

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

So it represent the statistical size of the uncompressed data? With or without possible changed rows or tombstones?

Copy link
Collaborator Author

@qiancai qiancai Feb 7, 2025

Choose a reason for hiding this comment

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

@dveeden How about the following changes?

Suggested change
* `TABLE_SIZE`: The total size of the table, in the unit of MiB. Note that this value is a logical estimate based on table statistics and does not represent the actual compressed physical size in storage.
* `TABLE_SIZE`: The total size of the table, in the unit of MiB. Note that this value is a logical estimate based on table statistics, whereas the actual compressed physical size in storage depends on storage formats, compression algorithms, and other physical storage optimizations.

* `TABLE_KEYS`: The total number of records in the table.
4 changes: 2 additions & 2 deletions information-schema/information-schema-tables.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ The description of columns in the `TABLES` table is as follows:
* `ROW_FORMAT`: The row format. The value is currently `Compact`.
* `TABLE_ROWS`: The number of rows in the table in statistics.
* `AVG_ROW_LENGTH`: The average row length of the table. `AVG_ROW_LENGTH` = `DATA_LENGTH` / `TABLE_ROWS`.
* `DATA_LENGTH`: Data length. `DATA_LENGTH` = `TABLE_ROWS` \* the sum of storage lengths of the columns in the tuple. The replicas of TiKV are not taken into account.
* `DATA_LENGTH`: Data length. `DATA_LENGTH` = `TABLE_ROWS` \* the sum of storage lengths of the columns in the tuple. The replicas of TiKV are not taken into account. Note that this value is a logical estimate based on table statistics and does not represent the actual compressed physical size in storage.
* `MAX_DATA_LENGTH`: The maximum data length. The value is currently `0`, which means the data length has no upper limit.
* `INDEX_LENGTH`: The index length. `INDEX_LENGTH` = `TABLE_ROWS` \* the sum of lengths of the columns in the index tuple. The replicas of TiKV are not taken into account.
* `INDEX_LENGTH`: The index length. `INDEX_LENGTH` = `TABLE_ROWS` \* the sum of lengths of the columns in the index tuple. The replicas of TiKV are not taken into account. Note that this value is a logical estimate based on table statistics and does not represent the actual compressed physical size in storage.
* `DATA_FREE`: Data fragment. The value is currently `0`.
* `AUTO_INCREMENT`: The current step of the auto- increment primary key.
* `CREATE_TIME`: The time at which the table is created.
Expand Down
Loading