This shows you the differences between two versions of the page.
— |
software:clickhouse [2021/08/02 14:29] (current) rb created |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Хелперы работы с clickhouse ====== | ||
+ | |||
+ | < | ||
+ | SELECT partition, name, table FROM system.parts WHERE active | ||
+ | |||
+ | </ | ||
+ | |||
+ | ss | ||
+ | |||
+ | < | ||
+ | SELECT * FROM system.parts WHERE active limit 1 | ||
+ | |||
+ | </ | ||
+ | |||
+ | ss | ||
+ | |||
+ | < | ||
+ | SELECT | ||
+ | name, | ||
+ | type, | ||
+ | formatReadableSize(data_compressed_bytes) AS compressed, | ||
+ | formatReadableSize(data_uncompressed_bytes) AS uncompressed, | ||
+ | data_uncompressed_bytes / data_compressed_bytes AS ratio, | ||
+ | compression_codec | ||
+ | FROM system.columns | ||
+ | WHERE (database = ' | ||
+ | ORDER BY data_compressed_bytes DESC | ||
+ | |||
+ | </ | ||
+ | ===== Изменение алгоритма компресии для колонки ===== | ||
+ | |||
+ | < | ||
+ | ALTER TABLE < | ||
+ | |||
+ | </ | ||
+ | |||
+ | Changes are applied lazily: only for new data and while merging. A trick to rewrite column data on disk: | ||
+ | |||
+ | < | ||
+ | ALTER TABLE < | ||
+ | |||
+ | </ | ||
+ | |||
+ | Процедура выполняется в фоне, чтобы проверить статус: | ||
+ | |||
+ | < | ||
+ | select * from system.mutations | ||
+ | |||
+ | </ | ||
+ | |||