Repository navigation
perf(ingest): a delivery lands in ONE staged write instead of a 500-row INSERT per chunk (#1453) - #1475
Merged
Conversation
…ow INSERT per chunk (#1453) land_base_delivery issued one bound-parameter INSERT of 500 rows per chunk. At 10M records that was 20,000 statements and 20,000 Parquet files, and on er-dev the ingest ran single-core for over an hour (two tries ran 67 minutes each before #1449 killed them). Rows now stream into a session temp table through a DuckDB appender, and one declared statement (raw_record.create.append_from_src) writes them into lake.main.raw_records in CSV order (ORDER BY seq). The delivery stays inside its one lake transaction, so a failed write still lands nothing and a retry is clean. Rows aren't buffered in memory, so 10M rows never sit in a Vec. This is the #1409 pattern, as used for events. Measured (release build, 1M rows of the #558 corpus): 22.1 s, of which 15.0 s is CSV parse and row prep and 7.0 s the single write, with one Parquet file. In a debug build at 100k: 27.3 s and 200 files before, 14.4 s and 1 file after. The large-delivery test now also asserts CSV order. The rollback and golden tests pass unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
athvin
temporarily deployed
to
marketing-preview
November 30, 2026 05:19 — with
GitHub Actions
Inactive
athvin
added a commit
that referenced
this pull request
Nov 30, 2026
… in memory at 10M (#1494) (#1496) #1475 staged a delivery and wrote it in one INSERT … SELECT, so one Parquet file. #558's 10M run then failed in standardize: Out of Memory, 7.4/7.4 GiB at class L, three minutes in. With the old layout (500-row files) standardize had passed at 10M in 7.4 minutes. Bisected locally at 2M rows with a 1.5 GB limit: - one file OOMs at 4 and 12 threads and passes at 1 and 2, so the cost is per-thread scan state; - small Parquet row groups inside one file (2048, 4096, 16384) still OOM, as do 2,000- and 20,000-row files; - disabling parquet prefetching or the metadata cache doesn't help; - 500-row files pass at 12 threads, twice; - moving the current-version window before the transforms didn't help, so it isn't part of this change. The staged appender stays. append_from_src now takes a seq range, and landing writes the staged rows in RAW_FILE_ROWS (500) slices, one short statement each. The old path's cost was 5,500 bound parameters per statement, not the count. Measured (debug build, 2M rows): ingest 111.7 s against 106 s for one file, 4,000 files, and standardize passes at 1.5 GB / 12 threads in 165.5 s. The large-delivery test (1,201 rows, three slices) still asserts CSV order. The rollback and golden tests pass. Co-authored-by: bmoore813 <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
athvin
added a commit
that referenced
this pull request
Nov 30, 2026
…ndardize needs more than 8GB of DuckDB (#558) (#1501) #558's 10M run on er-dev, with a realistic-cardinality corpus, failed standardize with Out of Memory (7.4/7.4 GiB) at class L's 14Gi / 8GB: - on #1475's single-file layout, after 3 minutes; - on #1496's 500-row files, after 4.5 minutes, at 13.2 of 14 GiB. The old layout's earlier pass at 10M was on a low-cardinality corpus. Every runner-l shape has at least 32 GiB (c5ad, c6id or c8id.4xlarge; m6id has 64), and L used 14 of it. L is now 26Gi with DuckDB at 18GB, which keeps DuckDB strictly below the container (the D-SIZING invariant) and leaves room for the node's daemonsets. That means one L pod per node. The dev namespace already admits at most two L pods, since ephemeral storage refuses a third: 2 x 26Gi + app = 57Gi of the 80Gi quota. helm template renders ER_DUCKDB_MEMORY_LIMIT=18GB with 26Gi requests and limits. infrastructure.md §6.5, batch-orchestration-design and the quota comment are updated. Co-authored-by: bmoore813 <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
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 #1453
What
A delivery's rows now stream through a DuckDB appender into a session temp table. One declared statement,
raw_record.create.append_from_src, then writes them intoraw_recordsin CSV order. This replaces a 500-row bound-parameterINSERTper chunk.Why
At 10M records the old path was 20,000 statements and 20,000 Parquet files. #558's er-dev run spent 79 minutes in single-core ingest (17:07:48 → 18:26:52Z), the longest stage of the run.
Proof
Release build, 1M rows of the #558 corpus: 22.1 s (15.0 s CSV parse and row prep, 7.0 s the single write), one Parquet file. Debug build at 100k: 27.3 s and 200 files before, 14.4 s and 1 file after. The large-delivery test now asserts CSV order. The rollback, golden and receipt tests pass unchanged.
make checkexit 0.Risk & rollback
The delivery stays in its one lake transaction, so a failed write lands nothing and a retry is clean (tested). Rows aren't buffered in memory. Rollback:
git revert <merge-sha>.Post-merge ledger
Closed by: agent · session
Claude Code:24d16c2e-fec6-49d8-9797-060338df4848onMac· 2026-11-30T05:47:40Zmainis 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: — faf79d1, rust 46358864472 + frontend 46358864329 success
imagesbuilt, or correctly never ran because nothing that goes intoan image changed: — success, run 46358864402
deployconverged — proved by a line the running process emitted, notby the image digest and not by the workflow conclusion: — its own deploy was superseded by 5f1e3bb (perf(resolve): a cached session per dataset and a blocking prefilter, ~5x faster at 520k (#1429) #1476), which contains faf79d1: deploy 46359969617 success, DEPLOY_SHA 5f1e3bb. The live 10M proof is 10M-scale spill run without eviction #558's rerun on this build
deploy,drift,kind's nightly leg) is green, or knowingly red for a reason that is notthis change: — infra, devcontainer success on faf79d1
Donethrough the automation rather than byhand, and the issue closed: — perf(ingest): a 10M-record ingest runs on one core for over an hour — class L's 16 vCPUs buy it nothing #1453 CLOSED by perf(ingest): a delivery lands in ONE staged write instead of a 500-row INSERT per chunk (#1453) #1475 via automation
(a skill, a reference, memory) — or nothing new was learned: — dev-profile timings of workspace Rust code are opt-level 0 and overstate prep ~4x; measure release before choosing what to parallelise
Specific to this change
01a22b06…on er-dev, class L, 10,011,103 records: ingest 7m51s (05:57:47 → 06:05:38Z) on this build, against 79m04s on the per-chunk INSERT build (17:07:48 → 18:26:52Z on 2026-11-29).Context — plan, discoveries, measurements, files
Plan
Discoveries
Measurements
Files
🤖 Generated with Claude Code