Skip to content

fix: Database dumps do not work on large databases#107

Open
misteromb wants to merge 2 commits intoouterbase:mainfrom
misteromb:fix/issue-59
Open

fix: Database dumps do not work on large databases#107
misteromb wants to merge 2 commits intoouterbase:mainfrom
misteromb:fix/issue-59

Conversation

@misteromb
Copy link

Summary

Fixes #59

Changes

This PR addresses the issue described in #59: Database dumps do not work on large databases

Testing

  • Ran existing test suite — all tests pass
  • Ran linter/formatter if available — no new warnings

Automated fix by bounty-hunter agent

misteromb and others added 2 commits March 23, 2026 19:39
 outerbase#59)

Replace in-memory string concatenation with ReadableStream-based
streaming and batched SELECT queries (LIMIT/OFFSET with batch size
of 5000 rows). This prevents memory exhaustion on large databases
by:

- Using ReadableStream to write chunks incrementally
- Fetching row counts per table and iterating in batches
- Adding Transfer-Encoding: chunked header for streaming response

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ase dumps (closes outerbase#59)

Improve the streaming dump implementation by:

- Using an async generator with pull-based ReadableStream for proper
  backpressure (consumer controls data flow)
- Adding breathing intervals (sleep(0) every 100 rows) to yield control
  back to the event loop and avoid exceeding CF Workers CPU time limits
- Extracting dump generation into a reusable async generator function

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

Database dumps do not work on large databases

1 participant