serialization sparse full ratio 10 100 1000 CREATE TABLE test_full_{ratio} (id UInt64, u8 UInt8, u64 UInt64, str String) ENGINE = MergeTree ORDER BY id CREATE TABLE test_sparse_{ratio} (id UInt64, u8 UInt8, u64 UInt64, str String) ENGINE = MergeTree ORDER BY id SETTINGS ratio_of_defaults_for_sparse_serialization = 0.8 SYSTEM STOP MERGES test_{serialization}_{ratio} INSERT INTO test_{serialization}_{ratio} SELECT number, number % {ratio} = 0 ? rand(1) : 0, number % {ratio} = 0 ? rand(2) : 0, number % {ratio} = 0 ? randomPrintableASCII(64, 3) : '' FROM numbers(100000000) SELECT u8 FROM test_{serialization}_{ratio} FORMAT Null SELECT u64 FROM test_{serialization}_{ratio} FORMAT Null SELECT str FROM test_{serialization}_{ratio} FORMAT Null SELECT erf(u64) FROM test_{serialization}_{ratio} FORMAT Null SELECT lower(str) FROM test_{serialization}_{ratio} FORMAT Null SELECT id FROM test_{serialization}_{ratio} ORDER BY u64 DESC LIMIT 100 FORMAT Null SELECT id FROM test_{serialization}_{ratio} ORDER BY str DESC LIMIT 100 FORMAT Null SELECT id FROM test_{serialization}_{ratio} ORDER BY u8, u64 DESC LIMIT 100 FORMAT Null SELECT * FROM test_{serialization}_{ratio} ORDER BY u8, u64 DESC LIMIT 100 FORMAT Null SELECT sum(u64) FROM test_{serialization}_{ratio} GROUP BY id % 11 FORMAT Null SELECT uniq(str) FROM test_{serialization}_{ratio} GROUP BY id % 11 FORMAT Null SELECT count() FROM test_{serialization}_{ratio} WHERE u64 > 0 SELECT count() FROM test_{serialization}_{ratio} WHERE notEmpty(str) DROP TABLE IF EXISTS test_{serialization}_{ratio}