10 items 1000 100000 10000000 CREATE TABLE test ( `id` UInt64, `value` UInt64, `text` String ) ENGINE = Memory INSERT INTO test SELECT number as id, rand64() as value, toString(number) as text FROM numbers({items}) SELECT groupArraySorted(10)(id, value) FROM test SELECT groupArraySorted(10)(id, -value) FROM test SELECT groupArraySorted(10)(text, value) FROM test SELECT groupArraySorted(10)((id, text), value) FROM test SELECT groupArraySorted(10)(value) FROM test SELECT groupArraySorted(10)(text) FROM test DROP TABLE IF EXISTS test