once
30000
1
aggregationscale
111111
11111
create table mingroupby_orderbylimit1_{aggregationscale}_tuple
Engine=MergeTree order by tuple() AS
select toUInt64( number % {aggregationscale} ) key, toUInt64(1) value
from numbers(2000000);
create table mingroupby_orderbylimit1_{aggregationscale}_key_value
Engine=MergeTree order by (key,value) AS
select toUInt64( number % {aggregationscale} ) key, toUInt64(1) value
from numbers(2000000);
SELECT key, min(value)
FROM mingroupby_orderbylimit1_{aggregationscale}_tuple
group by key format Null;
SELECT key, min(value)
FROM mingroupby_orderbylimit1_{aggregationscale}_key_value
group by key format Null;
SELECT key, value
FROM mingroupby_orderbylimit1_{aggregationscale}_tuple
order by key, value limit 1 by key format Null;
SELECT key, value
FROM mingroupby_orderbylimit1_{aggregationscale}_key_value
order by key, value limit 1 by key format Null;
DROP TABLE IF EXISTS mingroupby_orderbylimit1_{aggregationscale}_tuple
DROP TABLE IF EXISTS mingroupby_orderbylimit1_{aggregationscale}_key_value