Хелперы работы с 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 = 'traffic') AND (table = 'raw')
ORDER BY data_compressed_bytes DESC

Изменение алгоритма компресии для колонки

ALTER TABLE <database>.<table> MODIFY COLUMN <column> CODEC(Delta(4), ZSTD(10))

Changes are applied lazily: only for new data and while merging. A trick to rewrite column data on disk:

ALTER TABLE <database>.<table> UPDATE <column> = <column> WHERE 1

Процедура выполняется в фоне, чтобы проверить статус:

select * from system.mutations