Skip to content

Extend aggregation-in-order LIMIT push-down performance test - #110400

Merged
PedroTadim merged 2 commits into
masterfrom
perf-agg-in-order-limit-permuted-group-by
Jul 14, 2026
Merged

PedroTadim merged 2 commits into
masterfrom
perf-agg-in-order-limit-permuted-group-by

Conversation

@thevar1able

@thevar1able thevar1able commented Jul 14, 2026 •

Copy link
Copy Markdown
Member

Extends tests/performance/aggregation_in_order_limit.xml with the cases raised in review of #104859: ORDER BY as a single-column subset of GROUP BY, GROUP BY columns permuted relative to the table sorting key, and a permuted GROUP BY with an extra non-key column combined with a subset ORDER BY.

The push-down applies in all three cases because the group-by keys are matched as a set against the table sorting key, so the ORDER BY remains a prefix of the group-by sort description. Measured on hits_100m_single with optimize_aggregation_in_order_limit on/off (master 26.7.1.899, best of 5 runs):

Query Time (on) Time (off) Diff
GROUP BY CounterID, EventDate ORDER BY CounterID LIMIT 10 4 ms 5 ms -20%
GROUP BY EventDate, CounterID ORDER BY CounterID, EventDate LIMIT 10 4 ms 6 ms -33%
GROUP BY RegionID, EventDate, CounterID ORDER BY CounterID, EventDate LIMIT 10 23 ms 167 ms -86%

In all three cases read_rows drops from 100M to 43M, identical to the canonical prefix-match queries already in the test — confirming the same plan is used.

Related: #104859 (comment)

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

🤖 Generated with Claude Code

Version info

  • Merged into: 26.7.1.943 (included in 26.7 and later)

Add queries for the cases raised in review of #104859:
`ORDER BY` as a single-column subset of `GROUP BY`, `GROUP BY` columns
permuted relative to the table sorting key, and a permuted `GROUP BY`
with an extra non-key column combined with a subset `ORDER BY`.

Related: #104859 (comment)

Co-Authored-By: Claude Fable 5 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [01cec98]

Summary: ✅


AI Review

Summary

This PR extends tests/performance/aggregation_in_order_limit.xml with three additional benchmark shapes for aggregation-in-order LIMIT push-down. I did not find a remaining correctness, safety, or review-process issue in the current diff: the change is scoped to performance coverage, matches the follow-up request from the earlier review on #104859, and does not weaken the existing deterministic stateless coverage around the optimization.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Jul 14, 2026
@PedroTadim
PedroTadim enabled auto-merge July 14, 2026 14:43
@PedroTadim
PedroTadim added this pull request to the merge queue Jul 14, 2026
Merged via the queue into master with commit 2578f19 Jul 14, 2026
176 checks passed
@PedroTadim
PedroTadim deleted the perf-agg-in-order-limit-permuted-group-by branch July 14, 2026 17:33
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jul 14, 2026
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
…r-limit-permuted-group-by

Extend aggregation-in-order LIMIT push-down performance test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-not-for-changelog This PR should not be mentioned in the changelog pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants