starbasedb icon indicating copy to clipboard operation
starbasedb copied to clipboard

fix: Support large database dumps with streaming and pagination

Open codeboost-tr opened this issue 5 months ago • 1 comments

Fixes #59

Problem

Database dump endpoints load all data into memory. For >1GB databases, this causes memory exhaustion (128MB limit) and 30-second CPU timeout.

Changes

  • Streaming: dump, JSON, CSV exports now use ReadableStream
  • Pagination: SQL queries use LIMIT/OFFSET (500 rows/chunk)
  • Memory safe: constant memory usage regardless of DB size

New endpoints

  • /export/json-stream/:tableName - streaming JSON
  • /export/csv-stream/:tableName - streaming CSV

codeboost-tr avatar Jun 05 '26 09:06 codeboost-tr

I have updated the PR to resolve several regressions found in the initial streaming implementation. Fixed a crash in the database dump route and updated the unit tests to match the new chunked/streaming behavior. All export-related tests are now passing locally.

codeboost-tr avatar Jun 07 '26 18:06 codeboost-tr