Files
datastore/tests/performance/short_query_aggregation_overhead.xml
Alexey MilovidovandClaude Opus 4.6 ffe51e28fb Add performance test for short query aggregation pipeline overhead
Tests 100 UNION ALL subqueries with GROUP BY + ORDER BY on a
single-row table where no rows match the filter. This measures the
overhead of pipeline construction (transforms, resize) when there
is essentially no data to process — the scenario improved by capping
the post-aggregation resize to `min(max_threads, numStreams)`.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
2026-03-22 17:53:55 +01:00

116 lines
13 KiB
XML

<test>
<create_query>
CREATE TABLE short_agg_test (time DateTime, path String, hits UInt64) ENGINE = MergeTree ORDER BY (path, time)
</create_query>
<fill_query>
INSERT INTO short_agg_test VALUES (now(), '', 0)
</fill_query>
<!-- 100 UNION ALL of short queries with GROUP BY + ORDER BY that return no rows.
Tests the overhead of pipeline construction (transforms, resize) when there is no data to process. -->
<query>
SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
UNION ALL SELECT time::Date AS d, sum(hits), count() FROM short_agg_test WHERE path = 'nonexistent' GROUP BY d ORDER BY d
FORMAT Null
</query>
<drop_query>DROP TABLE IF EXISTS short_agg_test</drop_query>
</test>