GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — bindings: insert_many reads its rows a chunk at a time, so memory no longer grows with the row count (#294) by tae898 · Pull Request #295 · humemai/arcadedb-embedded-python

This repository was archived by the owner on Nov 21, 2026. It is now read-only.

Conversation

@tae898

@tae898 tae898 commented Oct 8, 2026

Copy link
Copy Markdown

Fixes #294.

insert_many read its whole iterable into a list, serialized it to one JSON text, and the engine parsed that text into one JSON array before inserting anything, so a load held about 1.5 KB per row at once. It now reads 10,000 rows at a time and sends each chunk as its own JSON text inside the transaction it manages.

Behaviour

  • commit_every keeps its meaning: commits happen every commit_every rows counted across chunks, and a chunk never straddles a commit boundary. commit_every=0 is still one transaction. A caller's own transaction is still left to the caller.
  • The per-row fallback (values JSON cannot carry unchanged) now applies per chunk instead of to the whole input.
  • An exception raised by the iterable itself propagates unchanged; the open batch is rolled back and committed batches stay, as for any other failure. In the parallel mode the rows already handed to the writers are waited for first.
  • The parallel mode hands each chunk to the async writers and reads every chunk's failure count after the final waitCompletion().

The Java DocumentBatcher is unchanged. I checked the other bulk paths for the same pattern: GraphBatch.create_vertices and new_edges already send JSON in 100,000-row chunks, and insert_columns takes columns the caller already holds, so neither grows like this.

Measurements (laptop, cores 12-15, -Xmx6g, five properties, UNIQUE (host, ts), rows from a generator, commit_every=10_000)

Peak RssAnon, shipped 26.10.1 against this branch:

rows 26.10.1 this branch
0.5M 1.9 GB 0.8 GB
1M 4.5 GB 0.9 GB
2M 5.5 GB 1.0 GB
4M 8.2 GB 1.4 GB

RssAnon minus the committed heap stays near 0.5 GB on this branch at every size. Speed at 1M rows, interleaved, 8 pairs after a warm-up round: 14.2 to 15.1 s on this branch against 16.5 to 18.3 s before, faster in every pair. The package ran hot (about 97 C) and both arms throttled, so treat that only as "not slower".

Tests

TestInsertManyStreams in tests/test_bulk_insert.py (9 tests, about 5 s): rows are stored while the iterable is still being read; the Python peak allocation for 60,000 rows stays under 12 MB (it was about 25 MB and linear in the row count); commit_every counts across chunks; commit_every=0 stays one transaction; an iterable error keeps only the committed batches; a fallback chunk does not affect the others; the parallel mode streams every row and still raises on a duplicate in a later chunk. All 9 fail on the old code. The full suite has no new failures (the 19 failures in the count push-down and light-edge known-issue files fail the same way without this change, against the engine snapshot I tested on).

🤖 Generated with Claude Code

https://claude.ai/code/session_01WQegLio3qLR2dE6gBFhRK6

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@tae898 @claude
bindings: insert_many reads its rows a chunk at a time, so memory no …
99f42bc
…longer grows with the row count (#294)

insert_many called list(rows), serialized the whole list to one JSON text, and the engine parsed it into one JSON array before the first insert, so a load held about 1.5 KB per row at once (Python list, JSON text, parsed rows on the heap). It now reads 10,000 rows at a time and sends each chunk as its own JSON text inside the transaction it manages, committing every commit_every rows counted across chunks. The per-row fallback and the parallel mode work per chunk too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WQegLio3qLR2dE6gBFhRK6
@tae898
tae898 merged commit e6e9f95 into main Oct 8, 2026
48 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@tae898
tae898 deleted the issue/insert-many-memory branch October 8, 2026 14:50
@tae898 tae898 mentioned this pull request Oct 8, 2026
/next: time-series document load OOM declared as the bindings' insert_many defect #296
Merged
tae898 added a commit that referenced this pull request Oct 8, 2026
@tae898 @claude
/next: time-series document load OOM declared as the bindings' insert…
a516e76
…_many defect (#294) (#296)

The l4 arcadedb_ts_doc ingest at ts1000 was OOM-killed at the tier's 32 GB cap in the 26.10.1 campaign because Database.insert_many held the whole input three times at once; fixed by #295, which reads 10,000 rows at a time. The cell is now a declared outcome with one plain sentence under the time-series table, out of the unexplained-failure set, with a next-measurement line.

Keyed on the rows (l4, ts1000, arcadedb_ts_doc, ingest, every row oom_killed, embedded bindings version below _BINDINGS_FASTER_FROM), so it retires by itself once a row from the fixed bindings completes. No other cell is touched. page_check, PAGE-SPEC, CAMPAIGN row 86, and tests added.

Co-authored-by: Claude Opus 5.5 <[email protected]>
This was referenced Oct 21, 2026
Benchmark page: bindings cutoff, free-looking index timing, and three declarations #396
Closed
Benchmark page: bindings cutoff 26.10.2, index-before-load sentence, three declarations #397
Merged
Benchmarks: refuse an ArcadeDB wheel whose insert_many materialises the whole input #467
Closed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

insert_many holds the whole input in memory, so memory grows with the row count

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@tae898
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.