Added `index_length` column to `information_schema.tables` by KrzaQ · Pull Request #78119 · ClickHouse/ClickHouse · GitHub
Skip to content

Added index_length column to information_schema.tables#78119

Merged
rschu1ze merged 3 commits into
ClickHouse:masterfrom
KrzaQ:kq/add-index-length
Mar 31, 2025
Merged

Added index_length column to information_schema.tables#78119
rschu1ze merged 3 commits into
ClickHouse:masterfrom
KrzaQ:kq/add-index-length

Conversation

@KrzaQ

@KrzaQ KrzaQ commented Mar 22, 2025

Copy link
Copy Markdown
Contributor

Resolves #57590

Changelog category (leave one):

  • Improvement

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):

Added column index_length_column to information_schema.tables for better compatibility with MySQL.

@CLAassistant

CLAassistant commented Mar 22, 2025

Copy link
Copy Markdown

@jsc0218 jsc0218 added the can be tested Allows running workflows for external contributors label Mar 22, 2025
@jsc0218 jsc0218 self-assigned this Mar 22, 2025
@clickhouse-gh

clickhouse-gh Bot commented Mar 22, 2025

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [21c7dc1]

@clickhouse-gh clickhouse-gh Bot added the pr-improvement Pull request with some product improvements label Mar 22, 2025
@KrzaQ KrzaQ force-pushed the kq/add-index-length branch from 729fdd0 to b2ca555 Compare March 24, 2025 06:46
@rschu1ze rschu1ze changed the title system.tables,information_schema.tables: add index_length column Added index_length column system.tables and information_schema.tables Mar 24, 2025
@rschu1ze rschu1ze changed the title Added index_length column system.tables and information_schema.tables Added index_length column to system.tables and information_schema.tables Mar 24, 2025
Comment thread docs/en/operations/system-tables/tables.md Outdated
Comment thread src/Storages/IStorage.h Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No need to change anything in C++, all existing data can be gathered from fields

primary_key_size
marks_bytes
secondary_indices_compressed_bytes
secondary_indices_uncompressed_bytes
secondary_indices_marks_bytes

in system.parts.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fair enough. I looked at how the information_schema views are defined, and they all are simple select queries, so I thought that was the desired effect.

@KrzaQ KrzaQ force-pushed the kq/add-index-length branch from b2ca555 to 4a9a5f5 Compare March 25, 2025 02:10
@KrzaQ KrzaQ changed the title Added index_length column to system.tables and information_schema.tables Added index_length column to information_schema.tables Mar 25, 2025
@KrzaQ KrzaQ force-pushed the kq/add-index-length branch from 4a9a5f5 to 9e9148f Compare March 25, 2025 14:23
@KrzaQ

This comment was marked as resolved.

Comment thread docs/en/operations/system-tables/information_schema.md Outdated
This column is the computed sum of:
- compressed size of the primary index
- sum of all marks
- compressed size of all secondary indexes and their marks

The goal is to improve MySQL compatibility:
https://dev.mysql.com/doc/refman/8.4/en/information-schema-tables-table.html

Tests that touch the information_schema.tables have been adjusted:
- 01161_information_schema
- 02206_information_schema_show_database
- test_from_system_tables.py

Fixes ClickHouse#57590
@KrzaQ KrzaQ force-pushed the kq/add-index-length branch from 9e9148f to 86f260b Compare March 26, 2025 23:28
@KrzaQ

This comment was marked as resolved.

@rschu1ze

Copy link
Copy Markdown
Member

Let's see what CI says (it is unfortunately quite unstable at the moment).

@jsc0218

jsc0218 commented Mar 27, 2025

Copy link
Copy Markdown
Contributor

flaky

@rschu1ze rschu1ze added this pull request to the merge queue Mar 31, 2025
Merged via the queue into ClickHouse:master with commit 97a7738 Mar 31, 2025
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Mar 31, 2025
@clickgapai

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors pr-improvement Pull request with some product improvements pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add information_schema.tables.index_length

6 participants