mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-14 03:25:15 +00:00
34 lines
2.1 KiB
XML
34 lines
2.1 KiB
XML
<test>
|
|
<!-- 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(),
|
|
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>
|
|
<optimize_syntax_fuse_functions>1</optimize_syntax_fuse_functions>
|
|
</settings>
|
|
|
|
<substitutions>
|
|
<substitution>
|
|
<name>key</name>
|
|
<values>
|
|
<value>1</value>
|
|
<value>intHash32(number) % 1000</value>
|
|
</values>
|
|
</substitution>
|
|
</substitutions>
|
|
|
|
<query>SELECT sum(number) FROM numbers(1000000000) FORMAT Null</query>
|
|
<query>SELECT sum(number), count(number) FROM numbers(1000000000) FORMAT Null</query>
|
|
<query>SELECT sum(number), count(number) FROM numbers(1000000000) SETTINGS optimize_syntax_fuse_functions = 0 FORMAT Null</query>
|
|
<query>SELECT sum(number), avg(number), count(number) FROM numbers(1000000000) FORMAT Null</query>
|
|
<query>SELECT sum(number), avg(number), count(number) FROM numbers(1000000000) SETTINGS optimize_syntax_fuse_functions = 0 FORMAT Null</query>
|
|
|
|
<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>
|
|
<query>SELECT sum(number), count(number) FROM numbers(100000000) GROUP BY intHash32(number) % 1000 SETTINGS optimize_syntax_fuse_functions = 0 FORMAT Null</query>
|
|
<query>SELECT sum(number), avg(number), count(number) FROM numbers(100000000) GROUP BY intHash32(number) % 1000 FORMAT Null</query>
|
|
<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>
|
|
</test>
|