Cloudflare D1 vs Cloudflare Workers KV
Cloudflare D1: Serverless SQLite for Cloudflare Workers, priced per row read and written, with read replicas and time travel. Cloudflare Workers KV: Globally cached, eventually consistent key-value store for read-heavy data at Cloudflare's edge.
key differences
- Cloudflare D1 is primarily a relational database; Cloudflare Workers KV is key-value.
- Cloudflare Workers KV is built for larger datasets (≤ 1 PB) than Cloudflare D1 (≤ 100 GB).
- Horizontal scaling is manual in Cloudflare D1 and native in Cloudflare Workers KV.
- Transactions: Cloudflare D1 offers full ACID; Cloudflare Workers KV offers none.
- Only Cloudflare D1 has transactions, joins, secondary indexes, full-text search, triggers.
- Only Cloudflare Workers KV has ttl / expiry.
choose cloudflare-d1 for
- +Database-per-tenant SaaS on Workers
- +Edge apps, blogs and CMS backends
- +Configuration and feature metadata near users
- +Prototypes needing SQL without managing servers
best at · OLTP, Edge, Content
choose cloudflare-workers-kv for
- +Feature flags and configuration at the edge
- +URL redirects and routing tables
- +Authentication tokens and API key lookups
- +Caching rendered pages or API responses
best at · Edge, Cache, Coordination
Cloudflare D1 vs Cloudflare Workers KV: FAQ
What is the difference between Cloudflare D1 and Cloudflare Workers KV?
Cloudflare D1: Serverless SQLite for Cloudflare Workers, priced per row read and written, with read replicas and time travel. Cloudflare Workers KV: Globally cached, eventually consistent key-value store for read-heavy data at Cloudflare's edge. Cloudflare D1 is primarily a relational database; Cloudflare Workers KV is key-value. Cloudflare Workers KV is built for larger datasets (≤ 1 PB) than Cloudflare D1 (≤ 100 GB). Horizontal scaling is manual in Cloudflare D1 and native in Cloudflare Workers KV.
When should I choose Cloudflare D1 over Cloudflare Workers KV?
Choose Cloudflare D1 for database-per-tenant SaaS on Workers; edge apps, blogs and CMS backends; and configuration and feature metadata near users. Choose Cloudflare Workers KV for feature flags and configuration at the edge; URL redirects and routing tables; and authentication tokens and API key lookups.
Is Cloudflare D1 or Cloudflare Workers KV more popular?
Cloudflare D1 ranks #373 on the WhichDB Score (5.8/100) and Cloudflare Workers KV ranks #404 (4.4/100). Popularity is not fit: check the requirements that matter for your project.
Are Cloudflare D1 and Cloudflare Workers KV open source?
No. Cloudflare D1 is proprietary, closed-source software. No. Cloudflare Workers KV is proprietary, closed-source software.