Repository navigation
fix(standardize): build int_std_records in key-hash buckets, so a 10M corpus fits in memory (#558) - #1504
Merged
Conversation
… corpus fits in memory (#558) #558's 10M run kept failing standardize with Out of Memory: at 8GB (7.4/7.4 GiB), and after #1501 raised class L, at 18GB (16.7/16.7 GiB). Its working set grows with the corpus and DuckDB doesn't spill enough of the projection plus the current-version window. Locally, 2M rows need more than 1.5GB. The corpus is now standardized in buckets of hash(source_system, source_record_id): a CREATE TABLE AS for bucket 0, then an INSERT per further bucket. The window partitions by exactly that key, so every version of a record shares a bucket, and the union of the buckets is the single statement's result. Bucket count is ceil(rows / 1M); ER_STD_ROWS_PER_BUCKET overrides it. One bucket (any corpus up to 1M) is the same SQL as before. Both the person and account builders use it. Measured locally (2M rows, 1.5 GB limit, 12 threads, 500k-row buckets): standardize passes in 278 s with all 2,000,000 rows. std_hashes now also builds base_10 in 3-row buckets and requires the same table, both directions of EXCEPT ALL. build_int_std_records_with takes the bucket size, so the test doesn't touch the process env. Co-Authored-By: Claude Opus 5.5 <[email protected]>
athvin
temporarily deployed
to
marketing-preview
November 30, 2026 10:57 — with
GitHub Actions
Inactive
7 tasks
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #558
What
int_std_records(andacct_int_std_records) is built in buckets ofhash(source_system, source_record_id): aCREATE TABLE ASfor bucket 0, then anINSERTper further bucket. Bucket count is ceil(rows / 1M), overridable withER_STD_ROWS_PER_BUCKET. One bucket is exactly the old SQL.Why
The 10M run failed standardize with Out of Memory at 8GB, and again at 18GB after #1501 (16.7/16.7 GiB). The working set grows with the corpus and doesn't spill. The current-version window partitions by the bucket key, so every version of a record shares a bucket and the union of the buckets is the single statement's result.
Proof
Locally, 2M rows at a 1.5 GB limit and 12 threads with 500k buckets: standardize passes in 278 s with all 2,000,000 rows.
std_hashesbuilds base_10 in 3-row buckets and requires the same table in both directions ofEXCEPT ALL.make checkexit 0. The live 10M rerun on this build is the ledger's proof.Risk & rollback
Up to 1M rows: identical SQL. Above that: N statements in one stage. Rollback:
git revert <merge-sha>.Post-merge ledger
Closed by: unclosed
mainis green with this change on it — the merge SHA, and the runthat proves it. A later head SHA with this commit as an ancestor counts;
a cancelled run with zero jobs does not:
imagesbuilt, or correctly never ran because nothing that goes intoan image changed:
deployconverged — proved by a line the running process emitted, notby the image digest and not by the workflow conclusion:
deploy,drift,kind's nightly leg) is green, or knowingly red for a reason that is notthis change:
Donethrough the automation rather than byhand, and the issue closed:
(a skill, a reference, memory) — or nothing new was learned:
Specific to this change
Context — plan, discoveries, measurements, files
Plan
Discoveries
Measurements
Files
🤖 Generated with Claude Code