Read from a replica or snapshot (never the primary), page through with keyset pagination instead of OFFSET, throttle the read rate, and stream results straight to object storage. The goal is to export 500M rows without holding long locks, spiking primary CPU, or blowing up memory.
Export pipeline
Primary DB ──async replication──▶ Read replica / snapshot
│ (isolated from live traffic)
▼
Export worker
keyset page: WHERE id > :last
│ throttle (sleep / rate limit)
▼
Stream (batches)
│
▼
S3 / GCS (NDJSON / Parquet)
