Skip to content

perf(resolve): precompute symmetric blocking keys, and read only the candidates' rows (#1505) - #1506

Merged
athvin merged 1 commit into
mainfrom
perf/1429-key-columns
Nov 30, 2026
Merged

athvin merged 1 commit into
mainfrom
perf/1429-key-columns

Conversation

@athvin

@athvin athvin commented Nov 30, 2026

Copy link
Copy Markdown
Owner

Closes #1505

Part of #1429. #1429 stays open until er-dev measures p95 under 300 ms.

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

What

  • Precomputed symmetric keys. A rule written f(l) = f(r) holds exactly when f(corpus) = f(probe). symmetric_key recognises it: one top-level =, and the right side is the exact l/r mirror of a left side that reads only l.. The key table stores f(corpus) per row as __k<i>, computed once per refresh, and each call compares it with the probe's f(probe). Other rules keep their both-orientation condition. A one-off call still filters the corpus directly in one scan.
  • Only the candidates' rows. A detached key table also records each row's filename and file_row_number, and a call reads only those rows: the same union_by_name file set, filtered per hit file on file_row_number.
  • The benchmark times er-dev's shape. resolve_latency_at_scale takes the expected answer through the lake, then times a lake-free session that refreshes itself and resolves from the files, asserting every answer equals the lake's.

Why

On er-dev 28b33aa0 (#1503), the prefilter took 632 ms of a 945 ms resolve, with p50 1164 / p95 1447 ms. Locally, on the detached path at 520k records, single-threaded:

  • about 225 ms re-evaluated every rule over all cached keys per call;
  • about 150 ms read every corpus file for the candidates.

Proof

resolve_latency_at_scale, detached, 519,984 records, 1 thread (all answers equal the lake resolve):

p50 p95
before (#1503) 505 ms 520 ms
+ precomputed symmetric keys 237 ms 277 ms
+ candidate rows by file and row 148 ms 169 ms
  • Unit tests pin symmetric_key: mirrored, range, two equalities, and = inside a literal.
  • These pass: resolve (8), acct_ (12), er-cli lib (23), a_detached_resolve_matches_the_lake_resolve, and pg_launch_proof.
  • make check: exit 0.

Risk & rollback

  • Key table: it gains one column per symmetric rule (4 person / 3 account) and, when detached, two locator columns. That's tens of MB at 520k.
  • Unrecognised rules: a rule the splitter can't prove symmetric keeps the exact per-call condition.
  • Rollback: git revert <merge-sha>.

Post-merge ledger

Closed by: unclosed

  • main is green with this change on it — the merge SHA, and the run
    that proves it. A later head SHA with this commit as an ancestor counts;
    a cancelled run with zero jobs does not:
  • images built, or correctly never ran because nothing that goes into
    an image changed:
  • deploy converged — proved by a line the running process emitted, not
    by the image digest and not by the workflow conclusion:
  • the push-only surface no pull request can pre-test (deploy, drift,
    kind's nightly leg) is green, or knowingly red for a reason that is not
    this change:
  • the board card reached Done through the automation rather than by
    hand, and the issue closed:
  • follow-ups are open for everything deferred here — numbers:
  • what was learned is written down where the next session will find it
    (a skill, a reference, memory) — or nothing new was learned:

Specific to this change

  • er-dev resolve latency on p3live after deploy, 55 calls, with the resolve timings medians:

🤖 Generated with Claude Code

…candidates' rows (#1505)

er-dev on 28b33aa: prefilter 632 ms of a 945 ms resolve. Locally, on the
detached path at 520k (1 thread), about 225 ms of that re-evaluated every
blocking rule, in both orientations, over all cached keys per call, and about
150 ms read every corpus file for the candidates' rows.

- A rule written f(l) = f(r) (symmetric_key: one top-level =, the right side
  the exact l/r mirror of a left side that reads only l.) holds exactly when
  f(corpus) = f(probe). The key table stores f(corpus) per row as __k<i>,
  computed once per refresh, and a call compares it with the probe's
  f(probe). Any other rule keeps its both-orientation condition. A one-off call
  still filters the corpus directly in one scan.
- A detached key table also records each row's filename and file_row_number,
  and a call reads only those rows: the same union_by_name file set,
  filtered per hit file on file_row_number.

resolve_latency_at_scale now times er-dev's shape: the expected answer through
the lake, then a lake-free session that refreshes itself and resolves from the
files, asserting each answer equals the lake's. At 519,984 records, 1 thread:
p50 505 to 148 ms, p95 520 to 169 ms. Unit tests pin symmetric_key. Resolve (8),
acct_ (12), er-cli lib (23), a_detached_resolve_matches_the_lake_resolve and
pg_launch_proof pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

This branch was previously deployed

1 inactive deployment
marketing-preview — 9da536f0 Deployed Nov 30, 2026 by athvin via remove closed PR previews #199
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.

Resolve's in-memory prefilter re-evaluates every blocking rule over all corpus keys, and reads every file for candidates (#1429 follow-up)

2 participants