performance comparison

This commit is contained in:
Alexander Kuzmenkov 2020-04-16 23:54:52 +03:00
parent 475ab6feef
commit fa62be250f
3 changed files with 30 additions and 15 deletions

View File

@ -1,8 +1,8 @@
<test> <test>
<query>SELECT arraySlice(arrayFill(x -> ((x % 2) >= 0), range(100000000)), 1, 10) FORMAT Null</query> <query>SELECT arraySlice(arrayFill(x -> ((x % 2) >= 0), range(100000000)), 1, 10) FORMAT Null</query>
<query>SELECT arraySlice(arrayFill(x -> (((x.1) % 2) >= 0), arrayMap(x -> (x, toString(x)), range(100000000))), 1, 10) FORMAT Null</query> <query>SELECT arraySlice(arrayFill(x -> (((x.1) % 2) >= 0), arrayMap(x -> (x, toString(x)), range(10000000))), 1, 10) FORMAT Null</query>
<query>SELECT arraySlice(arrayFill(x -> ((x % 2) >= 2), range(100000000)), 1, 10) FORMAT Null</query> <query>SELECT arraySlice(arrayFill(x -> ((x % 2) >= 2), range(100000000)), 1, 10) FORMAT Null</query>
<query>SELECT arraySlice(arrayFill(x -> (((x.1) % 2) >= 2), arrayMap(x -> (x, toString(x)), range(100000000))), 1, 10) FORMAT Null</query> <query>SELECT arraySlice(arrayFill(x -> (((x.1) % 2) >= 2), arrayMap(x -> (x, toString(x)), range(10000000))), 1, 10) FORMAT Null</query>
<query>SELECT arraySlice(arrayFill(x -> ((x % 2) = 0), range(100000000)), 1, 10) FORMAT Null</query> <query>SELECT arraySlice(arrayFill(x -> ((x % 2) = 0), range(100000000)), 1, 10) FORMAT Null</query>
<query>SELECT arraySlice(arrayFill(x -> (((x.1) % 2) = 0), arrayMap(x -> (x, toString(x)), range(100000000))), 1, 10) FORMAT Null</query> <query>SELECT arraySlice(arrayFill(x -> (((x.1) % 2) = 0), arrayMap(x -> (x, toString(x)), range(10000000))), 1, 10) FORMAT Null</query>
</test> </test>

View File

@ -12,53 +12,68 @@
<substitutions> <substitutions>
<substitution> <substitution>
<name>aggregationscale</name> <name>aggregationscale_all</name>
<values>
<value>1111111</value>
<value>111111</value>
<value>11111</value>
</values>
</substitution>
<substitution>
<name>aggregationscale_small</name>
<values> <values>
<value>111111</value> <value>111111</value>
<value>11111</value> <value>11111</value>
</values> </values>
</substitution> </substitution>
<substitution>
<name>aggregationscale_big</name>
<values>
<value>1111111</value>
<value>111111</value>
</values>
</substitution>
</substitutions> </substitutions>
<create_query> <create_query>
create table mingroupby_orderbylimit1_{aggregationscale}_tuple create table mingroupby_orderbylimit1_{aggregationscale_all}_tuple
Engine=MergeTree order by tuple() AS Engine=MergeTree order by tuple() AS
select toUInt64( number % {aggregationscale} ) key, toUInt64(1) value select toUInt64( number % {aggregationscale_all} ) key, toUInt64(1) value
from numbers(2000000); from numbers(2000000);
</create_query> </create_query>
<create_query> <create_query>
create table mingroupby_orderbylimit1_{aggregationscale}_key_value create table mingroupby_orderbylimit1_{aggregationscale_all}_key_value
Engine=MergeTree order by (key,value) AS Engine=MergeTree order by (key,value) AS
select toUInt64( number % {aggregationscale} ) key, toUInt64(1) value select toUInt64( number % {aggregationscale_all} ) key, toUInt64(1) value
from numbers(2000000); from numbers(2000000);
</create_query> </create_query>
<query tag='UsingGroupbyMinTuple'> <query tag='UsingGroupbyMinTuple'>
SELECT key, min(value) SELECT key, min(value)
FROM mingroupby_orderbylimit1_{aggregationscale}_tuple FROM mingroupby_orderbylimit1_{aggregationscale_big}_tuple
group by key format Null; group by key format Null;
</query> </query>
<query tag='UsingGroupbyMinKV'> <query tag='UsingGroupbyMinKV'>
SELECT key, min(value) SELECT key, min(value)
FROM mingroupby_orderbylimit1_{aggregationscale}_key_value FROM mingroupby_orderbylimit1_{aggregationscale_big}_key_value
group by key format Null; group by key format Null;
</query> </query>
<query tag='UsingOrderbyLimit1Tuple'> <query tag='UsingOrderbyLimit1Tuple'>
SELECT key, value SELECT key, value
FROM mingroupby_orderbylimit1_{aggregationscale}_tuple FROM mingroupby_orderbylimit1_{aggregationscale_small}_tuple
order by key, value limit 1 by key format Null; order by key, value limit 1 by key format Null;
</query> </query>
<query tag='UsingOrderbyLimit1KV'> <query tag='UsingOrderbyLimit1KV'>
SELECT key, value SELECT key, value
FROM mingroupby_orderbylimit1_{aggregationscale}_key_value FROM mingroupby_orderbylimit1_{aggregationscale_small}_key_value
order by key, value limit 1 by key format Null; order by key, value limit 1 by key format Null;
</query> </query>
<drop_query> DROP TABLE IF EXISTS mingroupby_orderbylimit1_{aggregationscale}_tuple </drop_query> <drop_query> DROP TABLE IF EXISTS mingroupby_orderbylimit1_{aggregationscale_all}_tuple </drop_query>
<drop_query> DROP TABLE IF EXISTS mingroupby_orderbylimit1_{aggregationscale}_key_value </drop_query> <drop_query> DROP TABLE IF EXISTS mingroupby_orderbylimit1_{aggregationscale_all}_key_value </drop_query>
</test> </test>

View File

@ -12,7 +12,7 @@
<create_query>CREATE TABLE join_table(A Int64, S0 String, S1 String, S2 String, S3 String) ENGINE = MergeTree ORDER BY A</create_query> <create_query>CREATE TABLE join_table(A Int64, S0 String, S1 String, S2 String, S3 String) ENGINE = MergeTree ORDER BY A</create_query>
<fill_query>INSERT INTO join_table SELECT number AS A, toString(arrayMap(x->x, range(100))) S0, S0 AS S1, S0 AS S2, S0 AS S3 from numbers(500000)</fill_query> <fill_query>INSERT INTO join_table SELECT number AS A, toString(arrayMap(x->x, range(100))) S0, S0 AS S1, S0 AS S2, S0 AS S3 from numbers_mt(5000000)</fill_query>
<query tag='UsingJoinWithoutSubquery'>SELECT COUNT() FROM join_table LEFT JOIN join_table USING A</query> <query tag='UsingJoinWithoutSubquery'>SELECT COUNT() FROM join_table LEFT JOIN join_table USING A</query>
<query tag='UsingJoinWithSubquery'>SELECT COUNT() FROM join_table LEFT JOIN (SELECT A FROM join_table) AS right USING A</query> <query tag='UsingJoinWithSubquery'>SELECT COUNT() FROM join_table LEFT JOIN (SELECT A FROM join_table) AS right USING A</query>