What is D1 vs Postgres Choice?
Choosing edge SQLite (D1) for globally distributed reads and zero-ops scale versus Postgres for rich types, extensions, and heavy relational workloads. BYOB generates D1-first apps and reaches for Supabase Postgres when measurements demand it.
Example
A content-heavy marketing app ships on BYOB DB with Drizzle queries through the native binding; when full-text search and row policies dominate the roadmap, the team promotes the data layer to Supabase Postgres.
What people get wrong
Choosing by hype instead of workload. Model reads, writes, transactions, and extensions first; both engines win somewhere, neither wins everywhere.
Frequently asked questions
Can a project start on D1 and move later?
Yes. Drizzle schemas port cleanly, and BYOB promotes the data layer to Supabase Postgres when workload measurements justify the move.
What pushes a workload toward Postgres?
Full-text search depth, complex joins across large tables, extensions, and per-user row policies at scale all favor Postgres over edge SQLite.
Related terms
Cloudflare D1 Database
SQLite at the edge: a relational database replicated near users with SQL semantics developers already know. BYOB DB provisions one per project with schema viewing and SQL inspection.
Managed Database
Storage provisioned inside the builder (BYOB DB, Supabase) without manual setup: credentials land in the project environment and schemas stay inspectable from the workspace.
Drizzle ORM
A typed TypeScript layer over SQL for schema definition and queries. Types generated from the live schema keep app code and database in agreement.
B-Tree Index
The default balanced-tree structure making equality and range lookups fast without scanning every row. Add one where queries filter, join, or sort — then confirm with EXPLAIN before assuming victory.
Composite Index
One index spanning several columns for queries that always filter them together, ordered most-selective first. A three-column composite beats three single-column indexes on the same query shape.
Partial Index
An index covering only rows matching a predicate, such as live subscriptions where status is active. Smaller, faster, and cheaper to maintain than indexing rows queries never touch.