8000 perf(query): stream certified count groups (#641) by adityamukho · Pull Request #779 · project-minigraf/minigraf · GitHub
[go: up one dir, main page]

Skip to content

perf(query): stream certified count groups (#641) - #779

Merged
adityamukho merged 2 commits into
v3from
feat/641-grouped-aggregate
Oct 28, 2026
Merged

adityamukho merged 2 commits into
v3from
feat/641-grouped-aggregate

Conversation

@adityamukho
@adityamukho adityamukho commented Oct 28, 2026 •
Copy link
Copy Markdown
Collaborator

Ordered grouped count and count-distinct now release completed groups instead of retaining every group. The snapshot proof admits one integer/Boolean/committed-float key (including mixed integer/float grouping), with no :with, windows, callbacks or collect-set. Fallible aggregates keep full-drain validation and existing error/drop-group precedence. A unique single-kind group key can omit the final ascending Sort; mixed numeric keys keep numeric sorting.

Depends on #778. This is slice 2 of #641; the issue stays open for partition windows. Companion docs: minigraf-docs #81.

At 10M committed rows in fixed groups of 16, full count is 33.41% faster and distinct count 40.25% faster. Ordered limit-10 queries take about 0.64–0.76 ms, with 10M/100K ratios of 0.988/0.994. Meter peaks stay at 480/1,120 bytes with one active group and 1,024 input reads under the limit; maximum RSS growth over 100K is 152 KiB. All 252 six-round grouped records are retained.

The single-growing-group control is explicit: distinct members still grow, count is 11.14–13.33% slower and distinct count 5.49–8.38% slower. A one-row selective grouped query rises from about 23–25 µs to 119–135 µs because of eight proof seeks (72 additional retained startup records). There is no cost-based strategy selection. Passing batches follow existing uncharged accounting; active groups, distinct members and finish scratch are charged, with no retained batch or finished-results list between calls. Internal child pulls evict DICT lookups; a targeted regression fails if that eviction is removed.

Validation on the bench: 1,947 default / 1,980 test-hooks passing; unchanged coverage floors pass (95.40% lines / 86.38% branches); strict native/browser/WASI clippy; WASI 1,179 passing and Firefox 60 passing; WASI release build; updated million-group acceptance; all 16 query/ordered_groups Criterion IDs executed and selected by the existing nightly ^query/ route. The appended native cache test passed filtered default/hooks and incremental coverage checks; the production library stayed byte-identical. Frozen answers are unchanged. The release binary is 1,259,368 bytes against the unchanged 1,259,520-byte cap.

All 12 exact #379 history guards pass (worst +0.68%); ordinary envelope point deltas are −1.16% to +1.60%. All 360 envelope/control and 144 history records are retained.

Claude reviewed the spec/plan and code, including the boundary INT-032 safeguard. Claude marked both the combined code/evidence and the selective startup-cost disclosure READY.

@codecov
codecov Bot commented Oct 28, 2026
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.79525% with 23 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/query/engine/aggregate.rs 91.55% 9 Missing and 4 partials ⚠️
src/query/engine/order.rs 96.59% 2 Missing and 6 partials ⚠️
src/query/engine/project.rs 0.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@adityamukho
adityamukho merged commit 9c32045 into v3 Oct 28, 2026
21 checks passed
@adityamukho
adityamukho deleted the feat/641-grouped-aggregate branch October 28, 2026 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0