DROP TABLE IF EXISTS test_avg_insert CREATE TABLE test_avg_insert (key UInt64, value AggregateFunction(avg, UInt8)) ENGINE = Memory() INSERT INTO test_avg_insert with initializeAggregation('avgState', 1) as s select number, s AS value FROM numbers(200000000) DROP TABLE IF EXISTS test_avg_insert