Skip to content

perf(read): measure the match_scores page reads — linear in active scores, accepted at current scale (#833) - #1441

Merged
athvin merged 1 commit into
mainfrom
perf/833-within-groups-measured
Nov 29, 2026
Merged

athvin merged 1 commit into
mainfrom
perf/833-within-groups-measured

Conversation

@athvin

@athvin athvin commented Nov 29, 2026 •

Copy link
Copy Markdown
Owner

Closes #833

Post-merge is part of this pull request. The ledger below records whether
the follow-up work actually happened. /land-pr closes it.

What

Measures the three per-page reads over match_scores and records each verdict in its statement's yaml description. The bounded fix for 10⁷ active scores is filed as #1440.

Why

#833's done-when: rows read and latency at a stated corpus size, a measurement for each candidate fix, and the verdict in the yaml. Verdict: linear in active scores, about 100 ms per million. Accepted at current tenant scale.

Proof

Harness: an uncommitted er-cli example on the engine's DuckDB 2.0.1 / DuckLake, with rows in write order (the table declares no order_by), 50-row pages, and p50/p95 over 20 runs after 3 warm-ups.

statement 2M active scores 8M active scores rows read
within_groups p50 196 ms p50 761 ms all
within_groups, scored bounded through members 190 ms 800 ms all (no gain)
uncertain_page 254 ms 784 ms the band
active_page 245 ms 780 ms the keyset half
active_page on a copy sorted by rec_a_key 20 ms 23 ms pruned

Live p3live (780k records): /duplicates p50 1227 / p95 1330 ms, /merge-plans p50 1761 ms per 50-entity page. make check exit 0.

Risk & rollback

Descriptions only. The generated doc comments move and no SQL changes. Rollback: git revert <merge-sha>.

Post-merge ledger

Closed by: agent · session Claude Code:24d16c2e-fec6-49d8-9797-060338df4848 on brians-MacBook-Pro · 2026-11-29T13:57:30Z

Specific to this change

Context — plan, discoveries, measurements, files

Plan

Discoveries

Measurements

Files

🤖 Generated with Claude Code

…ores, accepted at current scale (#833)

Measured in-process on DuckDB 2.0.1 / DuckLake, with rows in write order
(match_scores declares no order_by) and 50-row pages:

  within_groups   2M: p50 196 ms   8M: p50 761 ms   reads all rows
  uncertain_page  2M: p50 254 ms   8M: p50 784 ms   reads the band
  active_page     2M: p50 245 ms   8M: p50 780 ms   reads the keyset half

Restricting scored through members gains nothing: a page's members are
scattered across the key space, so neither zone maps nor the join filter
prune. Sort-on-write by rec_a_key helps active_page only (20-23 ms flat),
and it needs a table-level sort, since upsert_from_scored is a MERGE.
Live p3live (780k records) serves /duplicates at p50 1227 / p95 1330 ms
per page end to end, and /merge-plans at p50 1761 ms.

The verdict is recorded in each statement's description. The bounded fix
for 10^7 (an entity-keyed edge projection, plus the two layouts) is #1440.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@athvin
athvin merged commit 5c0bcdd into main Nov 29, 2026
44 checks passed
@athvin
athvin temporarily deployed to marketing-preview November 29, 2026 12:49 — with GitHub Actions Inactive

This branch was previously deployed

1 inactive deployment
marketing-preview — 18427ed9 Deployed Nov 29, 2026 by athvin via remove closed PR previews #168
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.

perf(read): within_groups scans the full active match_scores per request — measure before it matters

2 participants