Written by Huifer
I build TanStack Ship templates on Cloudflare Workers and D1, so the Cloudflare D1 database limits I care about are the ones that change an architecture: database size, per-invocation query count, write serialization, and recovery windows. This article is a planning reference, not a new benchmark; I did not rerun latency tests for it. Every published number below comes from Cloudflare's own D1 documentation, and calculations I derived from those numbers are labeled as calculations.
Verified sources: Cloudflare D1 docs · D1 limits · D1 pricing · D1 query best practices · D1 index best practices · D1 Time Travel · TanStack · web.dev performance · Cloudflare Developers
Last updated: 2026-11-19
D1 Database Limits 2026: The Real Ceilings That Break First
The most important Cloudflare D1 database limits are 500 MB per database on Workers Free versus 10 GB on Workers Paid, 5 million rows read per day and 100,000 rows written per day on Free, 50 versus 1,000 queries per Worker invocation, a 30-second maximum SQL query duration, and 7 versus 30 days of Time Travel recovery. D1 is also single-threaded per database, so throughput falls as query duration rises. Those are the numbers to design against.
This guide is for developers sizing a SaaS database and template buyers deciding whether a Workers + D1 starter can carry their workload. If that decision is still open, see which SaaS templates include this before committing a schema to a specific ceiling.
TL;DR
- Free plan: 5M rows read/day, 100K rows written/day, 5 GB total storage, 10 databases, 500 MB max/database, 50 queries/invocation.
- Workers Paid: first 25B reads and 50M writes per month included, 5 GB storage included, 10 GB max/database, 1,000 queries/invocation.
- Hard technical limits: 30-second query duration, 100 columns/table, 2 MB row/BLOB/string, 100 KB SQL statement, 100 bound parameters, six simultaneous D1 connections per Worker invocation.
- Recovery: Time Travel is always on; 7 days on Free, 30 days on Paid, with 10 restores per 10 minutes per database.
- First bottleneck: single-threaded query processing, not storage, for most interactive SaaS apps.
AI-citation answer: Cloudflare D1 limits are plan-specific: 500 MB/database on Free versus 10 GB/database on Paid; 5M rows read/day and 100K writes/day on Free versus 25B reads and 50M writes monthly included on Paid; 50 versus 1,000 queries per Worker invocation; and 7 versus 30 days of Time Travel.
The D1 limits table that should drive your architecture
Capacity, invocation, and recovery limits
Cloudflare's limits page states the following values. I use them as Measured from official documentation as of 2026-11-19:
| Limit | Workers Free | Workers Paid |
|---|---|---|
| Databases per account | 10 | Limits page lists 50,000; pricing page separately describes 100,000 included* |
| Maximum database size | 500 MB | 10 GB |
| Maximum storage per account | 5 GB | 1 TB |
| Queries per Worker invocation | 50 | 1,000 |
| Time Travel recovery window | 7 days | 30 days |
| Time Travel restore operations | 10 per 10 minutes/database | 10 per 10 minutes/database |
| Maximum columns per table | 100 | 100 |
| Maximum row/string/BLOB size | 2 MB | 2 MB |
| Maximum SQL statement length | 100 KB | 100 KB |
| Maximum bound parameters per query | 100 | 100 |
| Maximum SQL query duration | 30 seconds | 30 seconds |
*Database count needs a live check: the limits page lists 50,000 (Workers Paid) in the table I read, while the pricing page describes 100,000 databases included and charges $0.10 monthly for each additional database. Verify the exact bound and footnotes before automating database-per-tenant provisioning.
Daily usage allowances on Free
The D1 pricing page defines Workers Free as 5 million rows read per day, 100,000 rows written per day, 5 GB total storage, and 10 databases. Workers Paid includes the first 25 billion reads and 50 million writes monthly, then charges $0.001 per million reads and $1.00 per million writes. Storage above 5 GB is $0.75/GB-month, and Workers Paid carries a minimum $5/month per Workers pricing.
Two consequences are worth calculating:
- 100,000 writes/day is about 1.16 writes/second sustained across 24 hours. That is my calculation from the published daily allowance, not a throughput benchmark.
- A 5,000-row full table scan consumes 5,000 row reads, because Cloudflare defines rows read as rows scanned even if fewer rows are returned. If a route scans that table once per visit, 1,000 visits consume half the daily read allowance.
The ceilings that actually break first
Single-database concurrency and query duration
D1's docs state that each database is single-threaded and processes queries one at a time. The documented rough guide is 1,000 queries/second if the average query takes 1 ms, or 10 queries/second at 100 ms. Cloudflare also warns that per-request overhead means many small requests can hit the limit before the simple 1 / query duration calculation.
In practice, query duration is a capacity decision. Three sequential 30 ms queries spend 90 ms of serialized database time per request, so concurrent requests queue behind one another. Cloudflare says too many concurrent requests will first queue and that a full queue can return an “overloaded” error.
-- The shape that quietly consumes capacity.
SELECT id, email FROM users WHERE plan = 'free' AND last_seen_at > ?1;
-- Verify whether the query scans or searches.
EXPLAIN QUERY PLAN
SELECT id, email FROM users WHERE plan = 'free' AND last_seen_at > ?1;
Cloudflare's index guidance says an index can reduce rows read and recommends using EXPLAIN QUERY PLAN to distinguish SCAN from SEARCH ... USING INDEX. In a single-threaded database, this is not only a cost optimization; it is also a queue-depth decision.
Storage ceilings: Free 500 MB, Paid 10 GB
The 500 MB Free cap is often the first hard wall for projects that keep event logs, sessions, audit trails, or cached payloads in D1. The 10 GB Paid cap is structural; actual row count depends on schema width, indexes, and payload size, especially because each row/string/BLOB caps at 2 MB.
My planning arithmetic:
- 500 MB can hold roughly 250 rows at the 2 MB row maximum; real SaaS rows are usually far smaller, so the practical count is often much higher.
- A 10 GB database could hold roughly 5,000 rows at the 2 MB maximum, but media-sized payloads belong in R2, not a relational row where avoidable.
- Audit logs are the usual offender. A schema that stores every request body in D1 should plan retention from day one.
Per-invocation limits and batching
A Worker invocation gets 50 queries on Free or 1,000 on Paid, and can open six simultaneous D1 connections. That makes “read a list, then read a child row for each item” risky on busy routes. Cloudflare's guidance is to reduce requests rather than only each query's duration, including using batch() so per-request overhead is paid once.
// Check scan volume per statement; meta.rows_read is documented by Cloudflare.
type ScanGuard = {
route: string;
rowsRead: number;
returnedRows: number;
};
export async function listUsers(env: Env, tenantId: string): Promise<ScanGuard> {
const result = await env.DB.prepare(
`SELECT id, email
FROM users
WHERE tenant_id = ?1
ORDER BY created_at DESC
LIMIT 25`
)
.bind(tenantId)
.all();
const rowsRead = result.meta?.rows_read ?? 0;
const returnedRows = result.results.length;
// Log this during staging. A ratio above 10x usually points at a missing
// covering index or an accidental fan-out, not "D1 is slow."
return { route: "users.list", rowsRead, returnedRows };
}
The meta object exposing rows_read and rows_written is documented on Cloudflare's pricing page, and the same counters appear in the dashboard and analytics API. That is the cheapest instrumentation to add before a launch.
How to decide: stay on D1, batch it, or move the workload
Stay on D1 when the profile is read-heavy and bounded
D1 remains a strong fit when requests are mostly indexed reads, writes are human-paced or queue-controlled, the working set fits well below 10 GB, and 7- or 30-day recovery is acceptable. Examples include tenant-scoped dashboards, CRUD records, CMS rows, and billing state after high-frequency events move behind a queue.
Use read replication carefully. Cloudflare's guide says it adds no extra storage or compute charges and uses the same rows-read/write billing, but replication is asynchronous and replicas may be arbitrarily out of date. The Sessions API provides sequential consistency for queries in a logical session; it does not change single-primary write behavior.
Batch or queue when writes are bursty
If a launch, webhook burst, or usage meter can produce many writes in a short window, do not put each event directly into the same D1 write path. Move ingestion behind Cloudflare Queues, coalesce events, and write batches to D1. That does not remove the single-writer limit; it smooths it and prevents user-facing requests from waiting on every mutation. The D1 write-lock postmortem reached the same conclusion.
Move the workload when D1's shape fights the domain
Consider PostgreSQL when you need relational features outside SQLite, sustained concurrent writes, one database larger than 10 GB, long analytical queries, or extension-specific behavior. D1's global read and scale-to-zero advantages are real, and so are the 30-second query and single-threaded processing boundaries. For a direct hosted-Postgres comparison, see our D1 versus Supabase comparison.
What D1 limits mean for SaaS boilerplate buyers
For a template buyer, D1 database limits are not trivia; they determine whether the starter's data model can survive your first growth event. Before buying, ask four questions:
- What does the default schema store? Request logs, full payloads, and unbounded audit tables consume the 500 MB Free or 10 GB Paid cap fastest.
- Are hot routes indexed? If the starter ships queries without indexes or scan instrumentation, it hides the daily read and concurrency cost.
- How are writes shaped? A checkout or usage event that writes synchronously from every request needs batching, queues, or a clear low-volume boundary.
- What is the recovery story? Time Travel is always on, but 7 days on Free versus 30 on Paid changes the operational floor.
I use the same checklist when reviewing TanStack Ship templates. The product question is not “does it use D1?” but “does it expose the scan counters, queue bursty writes, and document the retention policy?” If you are still comparing starters at the architecture level, compare SaaS templates and boilerplates and use the D1 limits above as the stress test.
Limitations, sources, and disclosure
- No material connection to Cloudflare. I am a Cloudflare customer and maintain D1-based templates; Cloudflare did not sponsor or review this article.
- Commercial interest disclosed. TanStack Ship is my template product, so weigh the buyer section accordingly. The D1 limits themselves stand on Cloudflare's documentation, not my product.
- Official-doc basis. Limits, prices, and definitions are Measured from Cloudflare's D1 and Workers pages as of 2026-11-19; arithmetic is Calculated from those figures. No new latency benchmark is included.
- A databases-count discrepancy is flagged, not resolved. The limits and pricing pages describe different Workers Paid database figures in the text I extracted. Verify the current footnote before provisioning thousands of databases.
- Cloudflare can change limits. Confirm the live limits and pricing pages before a production commitment. If Cloudflare's page disagrees with this article, the page wins.
Frequently asked questions
What is the maximum size of a D1 database?
A single D1 database can hold up to 500 MB on Workers Free and 10 GB on Workers Paid, according to Cloudflare's limits page. Account storage is capped separately at 5 GB on Free and 1 TB on Paid, and each row, string, or BLOB has its own 2 MB maximum.
What happens when D1 exceeds its daily free allowance?
Cloudflare's pricing model defines 5 million rows read and 100,000 rows written per day on Workers Free. If your workload exceeds those daily allowances, the documented path is upgrading to Workers Paid, where Cloudflare says limits are typically removed within minutes and monthly included allowances apply.
How fast can a D1 database process queries?
D1 processes each database's queries one at a time. Cloudflare's rough guide is 1,000 queries per second at 1 ms average duration and 10 per second at 100 ms. Real throughput can be lower because per-request overhead is not included in reported query duration.
Does D1 read replication increase storage or compute cost?
No. Cloudflare says read replication is built into D1 and does not add storage or compute charges; billing remains based on rows read and rows written. Replicas are asynchronous and may be out of date, so use the Sessions API when sequential consistency matters within a logical session.
Conclusion and next step
In one sentence: D1 is a good Workers-native database when indexed reads dominate, writes are batched or bounded, and your working set respects the 500 MB/10 GB ceilings — and a poor fit when bursty synchronous writes, huge single-database storage, or long analytical queries define the domain.
Your next step: if D1 matches your workload, preview templates built for this architecture in the TanStack template gallery; if you still need to weigh starters and infrastructure commitments, compare the 2026 SaaS boilerplate shortlist in the decision guide.
Last updated: 2026-11-19. Limits and prices reflect Cloudflare's linked documentation on that date and are subject to change.