1
20G
CREATE TABLE optimized_select_final (d Date, key UInt64, value String)
ENGINE = ReplacingMergeTree()
PARTITION BY toYYYYMM(d) ORDER BY key
INSERT INTO optimized_select_final SELECT toDate('2000-01-01'), 2*number, randomPrintableASCII(1000) FROM numbers(1000000)
INSERT INTO optimized_select_final SELECT toDate('2020-01-01'), 2*number+1, randomPrintableASCII(1000) FROM numbers(1000000)
SELECT * FROM optimized_select_final FINAL FORMAT Null SETTINGS max_threads = 8
SELECT * FROM optimized_select_final FINAL WHERE key % 10 = 0 FORMAT Null
DROP TABLE IF EXISTS optimized_select_final