Files
datastore/tests/performance/limit_by_partitions.xml
2026-05-16 13:05:50 +00:00

46 lines
1.9 KiB
XML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<test>
<substitutions>
<substitution>
<name>size</name>
<values>
<value>100000</value>
<value>10000000</value>
</values>
</substitution>
<substitution>
<name>partitions</name>
<values>
<value>16</value>
<value>64</value>
</values>
</substitution>
</substitutions>
<create_query>CREATE TABLE t_{size}_{partitions} (a UInt64, b UInt64) ENGINE = MergeTree ORDER BY a PARTITION BY sipHash64(a) % {partitions}</create_query>
<!-- Skewed shape: 3 hot values × 30% rows each (90% total) + 27 values × ~0.37% each (10% total). -->
<create_query>CREATE TABLE t_skew_{size}_{partitions} (a UInt64, b UInt64) ENGINE = MergeTree ORDER BY tuple() PARTITION BY a</create_query>
<fill_query>INSERT INTO t_{size}_{partitions} SELECT number, number FROM numbers_mt({size})</fill_query>
<fill_query>OPTIMIZE TABLE t_{size}_{partitions} FINAL</fill_query>
<fill_query>INSERT INTO t_skew_{size}_{partitions} SELECT if(number % 10 &lt; 9, number % 3, 3 + (number % 27)) AS a, number AS b FROM numbers_mt({size})</fill_query>
<fill_query>OPTIMIZE TABLE t_skew_{size}_{partitions} FINAL</fill_query>
<query>SELECT a FROM t_{size}_{partitions} LIMIT 10 BY a FORMAT Null</query>
<query>SELECT a FROM t_{size}_{partitions} WHERE b > 1 LIMIT 10 BY a FORMAT Null</query>
<query>SELECT a, b FROM t_{size}_{partitions} LIMIT 10 BY a, b FORMAT Null</query>
<query>SELECT a FROM t_{size}_{partitions} LIMIT 100000000 BY a FORMAT Null</query>
<query>SELECT a FROM t_{size}_{partitions} ORDER BY b DESC LIMIT 10 BY a FORMAT Null</query>
<query>SELECT a FROM t_skew_{size}_{partitions} LIMIT 10 BY a FORMAT Null</query>
<drop_query>DROP TABLE t_{size}_{partitions}</drop_query>
<drop_query>DROP TABLE t_skew_{size}_{partitions}</drop_query>
</test>