FAQ: databases and storage
Answers about D1, R2, KV, Durable Objects, file uploads, recovery, and external databases.
Edited and verified by Orange Book Editorial Team ·
How do I choose among D1, R2, KV, and Durable Objects?
Choose by data model: D1 for relational business data, R2 for files and objects, KV for read-heavy key-value data that tolerates eventual consistency, and Durable Objects for strongly consistent coordination or per-entity state. Combining products is normal. Start with the storage chooser.
Can images or PDFs be stored directly in D1?
Avoid putting large file bodies in a relational database. Keep object key, tenant, state, and metadata in D1 while R2 stores the binary object. This keeps queries, migrations, lifecycle, and delivery paths clear.
Can one D1 database scale without bound?
No. The 2026-08-27 official limits are 500 MB per Free database and 10 GB per Paid database, and one database processes queries sequentially. Plan tenant or entity sharding, shorter queries, and migration before capacity or concurrency reaches the boundary.
Is KV suitable for sessions or real-time balances?
Only when the business can tolerate eventual consistency. A recent write can remain stale elsewhere for a period. Permission revocation, one-time tokens, balances, and concurrency locks generally need a stronger authoritative store.
Is an R2 bucket public immediately after creation?
No. Public access requires explicitly enabling a development URL or configuring a custom domain. Private objects should be served only after application authorization through short-lived access. Use the R2 production delivery recipe.
Should a large upload pass through Worker memory?
Usually not. Authorize the user, tenant, file type, and quota on the server, issue a short-lived presigned PUT, and let the client upload directly to R2. When proxying is unavoidable, stream the body instead of buffering it within the 128 MB isolate memory.
Is D1 Time Travel a complete backup strategy?
No. It offers point-in-time recovery within a defined window, but restore overwrites the database in place. It does not replace exports, migration rehearsals, permission separation, and tested business recovery. See D1 migrations and recovery.
Must an existing Supabase, Neon, Turso, or TiDB database move to D1?
No. Decide from SQL compatibility, transactions, connectivity, region, operations, and migration cost. Workers can reach external databases through HTTP, drivers, or Hyperdrive. Use the external database overview before rewriting a stable data layer.
Primary sources
Did this page help you complete your goal?
Beta feedback is generated in this browser and is never uploaded automatically.