Files
murphy-4o b2d5d9fd67 Add performance test for GROUP BY ... ORDER BY aggregate LIMIT K
Add `topn_aggregation.xml` exercising the query pattern targeted by the
`TopNAggregation` optimization (#98607):

- `max(EventTime)` DESC with ~130K groups (CounterID), LIMIT 10 and 100
- `min(EventTime)` ASC with ~100K synthetic groups, LIMIT 10
- `max(CounterID)` DESC where CounterID is the first MergeTree sorting
  key column (~1.2K RegionID groups), LIMIT 10

Made-with: Cursor
2026-04-08 08:30:44 +00:00

17 lines
939 B
XML

<test>
<!-- GROUP BY ... ORDER BY min/max LIMIT K pattern.
Exercises the TopNAggregation optimization when enabled. -->
<!-- max(EventTime) DESC, ~130K groups (CounterID) -->
<query>SELECT CounterID, max(EventTime) AS m FROM hits_100m_single GROUP BY CounterID ORDER BY m DESC LIMIT 10 FORMAT Null</query>
<!-- min(EventTime) ASC, ~100K synthetic groups -->
<query>SELECT intHash32(UserID) % 100000 AS k, min(EventTime) AS m FROM hits_100m_single GROUP BY k ORDER BY m ASC LIMIT 10 FORMAT Null</query>
<!-- max(EventTime) DESC, larger LIMIT -->
<query>SELECT CounterID, max(EventTime) AS m FROM hits_100m_single GROUP BY CounterID ORDER BY m DESC LIMIT 100 FORMAT Null</query>
<!-- max(CounterID) DESC with CounterID as the first sorting key column -->
<query>SELECT RegionID, max(CounterID) AS m FROM hits_100m_single GROUP BY RegionID ORDER BY m DESC LIMIT 10 FORMAT Null</query>
</test>