Database choice is the decision most likely to be regretted later and least likely to be analysed properly at the start.

The reason is understandable. At the beginning, any database works. You have a schema with six tables and a hundred rows. Everything is instant. The differences that matter only appear at scale, under concurrency, or when a requirement arrives that the chosen engine cannot express.

So the useful question is not “which is faster.” It is “what kind of system is this, and what will it be in two years.”

What Each One Is

PostgreSQL is a relational database with decades of development behind it. It runs as a server process, holds data in storage you control, and supports an unusually broad feature set: complex queries, joins, transactions, extensions, JSON documents, full-text search, geospatial data, and materialised views.

Cloudflare D1 is a serverless SQLite database. It is built on SQLite, the most widely deployed database engine in existence, and it is managed by Cloudflare, meaning there is no server to run, patch, or size.

They are not competitors in the usual sense. They occupy different positions on the same axis.

PostgreSQL D1 (SQLite)
Deployment Server you run or manage Fully managed, serverless
Scaling model Vertical, plus read replicas Edge-replicated reads
Concurrency High, row-level locking Single writer per database
Transactions Full, including complex isolation Full, but writer-serialised
Extensions Enormous ecosystem None
Operational burden Real, ongoing Essentially none
Cost model Instance hours Reads and writes
Data location Wherever you host it Cloudflare global network

Where PostgreSQL Is The Right Answer

PostgreSQL is the safe default because it is very rarely the thing that breaks first. If you have a hard problem, PostgreSQL has probably already solved it.

Systems with real relational complexity. Once you are joining eight tables with conditional logic and aggregations, you want a grown-up query planner. SQLite’s planner is good. PostgreSQL’s is better, and the gap widens with complexity.

Anything financial. Multi-statement transactions with strict isolation, careful locking, and an audit trail. PostgreSQL handles this correctly and has for decades. Concurrency patterns that involve a single writer become an obstacle quickly here.

Reporting and analytics. Window functions, common table expressions, materialised views. This is where PostgreSQL is genuinely ahead rather than merely adequate.

Requirements that arrive later. Full-text search, array columns, indexed JSON, geospatial via PostGIS. With PostgreSQL you add a column. With SQLite you often need a workaround or a second system.

Compliance and data residency. You choose where the data lives and you can prove it. For regulated industries this is not a preference, it is a requirement.

Where D1 Shines

I want to be fair to D1, because the common mistake is dismissing it as a toy. It is not.

Edge-located reads. For a read-heavy application serving users across geographies, having data answered near the user is a real advantage and removes an entire class of latency problem.

Zero operational surface. No instance to patch, no connection pool to tune, no backup job to remember. For a small team this is a genuine saving of attention, and attention is the scarcest resource in any engineering effort.

Cost at small scale. For a project with modest traffic, the economics of a managed serverless database are hard to beat, because you pay for usage rather than for capacity sitting idle.

Static-adjacent applications. If you already serve a site from Cloudflare’s platform, with edge functions handling logic, D1 sits naturally in that architecture with no network hop to a separate database host.

Typical D1 fit Why
Content-driven site with forms Read-heavy, low write concurrency
Internal tool with a small team Low load, no operations appetite
Prototype or MVP Cost and setup near zero
Global audience, read-mostly Edge replication wins
Small multi-tenant product Viable until write volume grows

The Single-Writer Constraint

This is the honest technical limitation and it deserves its own section, because it is where D1 projects surprise their owners.

SQLite permits one writer at a time per database. D1 manages this, but the fundamental model remains: writes are serialised. For a workload with occasional writes this is invisible. For a workload with high concurrent write volume, such as order processing, event ingestion, or real-time collaboration, it becomes the defining constraint.

It is not that writes are slow. It is that they queue, and under contention the tail latency rises in a way that is hard to predict from a benchmark.

If I am building something where two hundred users might submit something in the same second, D1 is the wrong choice and I would know that before writing any code.

The Decision Table I Actually Use

Question If yes If no
Will write concurrency exceed a few per second sustained? PostgreSQL D1 plausible
Do you need complex multi-table reporting? PostgreSQL Either
Are you already on Cloudflare’s edge? D1 favoured PostgreSQL favoured
Is there a compliance or residency requirement? PostgreSQL Either
Is the team without database operations experience? D1 favoured PostgreSQL
Will requirements include search, geo, or rich types? PostgreSQL Either
Is this a pre-product prototype? D1 PostgreSQL if it will grow

There is no shame in starting with D1 and migrating. Because both speak SQL, the migration is more tractable than moving between paradigms, but it is still real work, and it is worth being honest about that when choosing.

What We Do In Practice

For business systems with transactional requirements, PostgreSQL. Without hesitation, and it has never been the decision we regretted.

For marketing sites and small tools deployed at the edge, D1 when the write profile is light. The operational simplicity is worth real money.

The pattern I avoid is choosing D1 for a system whose requirements are not yet known, on the assumption that it can be swapped later. Schemas designed for a single-writer engine tend to make assumptions that are irritating to unwind.

If you are at this decision and want a second opinion, it is a much cheaper conversation before the schema exists than after.