loop
30000
6000
60000
1
CREATE TABLE array_data(k UInt16, v Array(UInt64)) ENGINE Log
INSERT INTO array_data SELECT number % 1024, arrayWithConstant(16, number) from numbers(10000000)
SELECT countMerge(v) FROM (SELECT countState() v FROM numbers(1000000000)) FORMAT Null
SELECT countMerge(v) FROM (SELECT number % 1024 k, countState() v FROM numbers(1000000000) GROUP BY k) FORMAT Null
SELECT sumArray(v) FROM array_data FORMAT Null
SELECT k, sumArray(v) FROM array_data GROUP BY k FORMAT Null
SELECT arrayReduce('avg', v) FROM array_data FORMAT Null
DROP TABLE IF EXISTS array_data