CREATE TABLE test_memory (x UInt64) ENGINE Memory INSERT INTO test_memory SELECT 1 FROM numbers(1000000000) SELECT sum(x * x + x) FROM test_memory DROP TABLE IF EXISTS test_memory