2021-03-15 13:57:09 +00:00
<test >
2021-03-15 14:11:17 +00:00
<!-- We test rewriting sum(), avg(), count() to a single call of sumCount() here.
As a reference, we use the same queries with the optimization disabled.
sum() has a highly optimized algorithm, so alone it will be faster than sumCount(),
2021-04-15 16:40:49 +00:00
but when we add count() or avg(), the sumCount() should win.
Also test GROUP BY with and without keys, because they might have different
optimizations. -->
<settings >
2021-09-14 12:27:12 +00:00
<optimize_syntax_fuse_functions > 1</optimize_syntax_fuse_functions>
2021-04-15 16:40:49 +00:00
</settings>
<substitutions >
<substitution >
<name > key</name>
<values >
<value > 1</value>
<value > intHash32(number) % 1000</value>
</values>
</substitution>
</substitutions>
2021-04-16 10:36:52 +00:00
<query > SELECT sum(number) FROM numbers(1000000000) FORMAT Null</query>
<query > SELECT sum(number), count(number) FROM numbers(1000000000) FORMAT Null</query>
2021-09-14 12:27:12 +00:00
<query > SELECT sum(number), count(number) FROM numbers(1000000000) SETTINGS optimize_syntax_fuse_functions = 0 FORMAT Null</query>
2021-04-16 10:36:52 +00:00
<query > SELECT sum(number), avg(number), count(number) FROM numbers(1000000000) FORMAT Null</query>
2021-09-14 12:27:12 +00:00
<query > SELECT sum(number), avg(number), count(number) FROM numbers(1000000000) SETTINGS optimize_syntax_fuse_functions = 0 FORMAT Null</query>
2021-04-16 10:36:52 +00:00
<query > SELECT sum(number) FROM numbers(100000000) GROUP BY intHash32(number) % 1000 FORMAT Null</query>
<query > SELECT sum(number), count(number) FROM numbers(100000000) GROUP BY intHash32(number) % 1000 FORMAT Null</query>
2021-09-14 12:27:12 +00:00
<query > SELECT sum(number), count(number) FROM numbers(100000000) GROUP BY intHash32(number) % 1000 SETTINGS optimize_syntax_fuse_functions = 0 FORMAT Null</query>
2021-04-16 10:36:52 +00:00
<query > SELECT sum(number), avg(number), count(number) FROM numbers(100000000) GROUP BY intHash32(number) % 1000 FORMAT Null</query>
2021-09-14 12:27:12 +00:00
<query > SELECT sum(number), avg(number), count(number) FROM numbers(100000000) GROUP BY intHash32(number) % 1000 SETTINGS optimize_syntax_fuse_functions = 0 FORMAT Null</query>
2021-03-12 07:29:38 +00:00
</test>