Scaling
Default: Container DuckDB over files in R2. WASM only when the working set is tiny.
Options
| Small (WASM) | Normal (Container) | Huge (R2 SQL) | |
|---|---|---|---|
| Engine | DuckDB in a Worker | DuckDB in a Container | Cloudflare scan SQL |
| Data | Same R2 files | Same R2 files | Same R2 files |
| Fits | ~48 MB Parquet / 64 MB RAM | Multi-GB interactive | Warehouse-scale scans |
| Idle | scales to zero | sleeps (cache clears) | pay per scan |
Move compute, not files
Switch when touched Parquet exceeds ~48 MB, queries spill past 64 MB, or you need full extensions / Iceberg.
org_acme
│
├── worker (WASM) ──┐
│ ├──▶ r2://…/org_acme/** (unchanged)
└── container (native)──┘Placement is metadata in D1. No lake copy.
R2 SQL
One-off monster scans: "engine":"r2sql". Needs R2_SQL_TOKEN. Dashboards stay on DuckDB.
After Container sleep
Local cache is gone. Next query re-reads from R2. See Limits.
Don’t
- Put analytical tables in D1
- Copy Parquet when changing placement
- Run an always-on warehouse for weekly queries
- Treat WASM and Containers as the same size box