Skip to content

system.detached_parts add column bytes_on_disk and path#42303

Merged
kssenii merged 20 commits intoClickHouse:masterfrom
xiedeyantu:system_table_add_column
Nov 8, 2022
Merged

system.detached_parts add column bytes_on_disk and path#42303
kssenii merged 20 commits intoClickHouse:masterfrom
xiedeyantu:system_table_add_column

Conversation

@xiedeyantu
Copy link
Copy Markdown
Contributor

@xiedeyantu xiedeyantu commented Oct 14, 2022

Changelog category (leave one):

  • Improvement

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

Add columns bytes_on_disk and path to system.detached_parts. Closes #42264.

@robot-clickhouse robot-clickhouse added the pr-feature Pull request with new product feature label Oct 14, 2022
@kssenii kssenii self-assigned this Oct 14, 2022
@kssenii kssenii added the can be tested Allows running workflows for external contributors label Oct 14, 2022
@robot-ch-test-poll1 robot-ch-test-poll1 added pr-improvement Pull request with some product improvements and removed pr-feature Pull request with new product feature labels Oct 14, 2022
@kssenii kssenii merged commit 92b5ca3 into ClickHouse:master Nov 8, 2022
@alexey-milovidov
Copy link
Copy Markdown
Member

@kssenii it does not avoid heavy calculations if the new column was not queried.

new_columns[i++]->insert(info.table);
new_columns[i++]->insert(p.valid_name ? p.partition_id : Field());
new_columns[i++]->insert(p.dir_name);
new_columns[i++]->insert(calculateTotalSizeOnDisk(p.disk, fs::path(info.data->getRelativeDataPath()) / detached_part_path));
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.

It may slow down select ... from system.detached_parts significantly, especially if object storage is involved. Moreover, a query slows down even if the bytes_on_disk column is not queried. We should not calculate bytes_on_disk if it was not queried.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Size of parts in system.detached_parts

6 participants