[{"data":1,"prerenderedAt":28},["ShallowReactive",2],{"$fGHSchGuM_Pgp5t4wO3fjp9KiAufOCWAWR8HoMgrIFvI":3},{"slug":4,"title":5,"description":6,"date":7,"tags":8,"draft":12,"readingMinutes":13,"html":14,"related":15},"sqlite-vs-postgres","SQLite vs Postgres: Pick by Writers, Not by Size","SQLite vs Postgres in 2026: SQLite 3.54 and Postgres 18. Why the number of processes writing at once decides it, not traffic or data size.","2026-11-15",[9,10,11],"sqlite","postgres","databases",false,4,"\u003Cp>My rule for SQLite vs Postgres is short: if one process on one machine does the writing, SQLite is a real option, often the better one. If several processes or several servers need to write, use Postgres and don&#39;t spend another hour on it. Data size and traffic matter much less than people assume. The number of writers is what decides it.\u003C/p>\n\u003Cp>Versions as I write this, on November 15, 2026: SQLite 3.54.1, PostgreSQL 18.7, with 19 at release candidate 2.\u003C/p>\n\u003Ch2>The traffic myth\u003C/h2>\n\u003Cp>People reject SQLite because it sounds like a toy, then pick Postgres for an internal tool with eleven users. SQLite&#39;s own \u003Ca href=\"https://www.sqlite.org/whentouse.html\">when to use page\u003C/a> says any site under 100K hits a day &quot;should work fine&quot;, calls that &quot;a conservative estimate, not a hard upper bound&quot;, and says it has been shown to work at ten times that. The size limit is 281 terabytes. Neither number is why you&#39;d pick Postgres.\u003C/p>\n\u003Cp>Laravel noticed. Since Laravel 11, a fresh project&#39;s \u003Ccode>.env\u003C/code> points at SQLite by default, and for a lot of small apps nobody ever changes it. That&#39;s a sensible default. You get a database that is one file, needs no server, no password, no connection pool and no separate backup job for a dev setup.\u003C/p>\n\u003Ch2>Where SQLite actually stops\u003C/h2>\n\u003Cp>Same page, the sentence that matters: SQLite &quot;supports an unlimited number of simultaneous readers, but it will only allow one writer at any instant in time.&quot;\u003C/p>\n\u003Cimg src=\"/blog/sqlite-vs-postgres/sqlite-postgres-write-timeline.webp\" alt=\"Timeline of three writers: SQLite queues them one after another, Postgres runs them at the same time with row locks\" width=\"1600\" height=\"900\" loading=\"lazy\">\u003Cp>For a web app with one app server, that&#39;s usually fine. Writes are short, they queue, and each one takes a few milliseconds. It goes wrong in three specific setups:\u003C/p>\n\u003Cp>\u003Cstrong>A queue worker next to the web process.\u003C/strong> Your web request writes, your background job writes, both are on the same file. Without a busy timeout, one of them gets \u003Ccode>SQLITE_BUSY\u003C/code> and the error you see is \u003Ccode>database is locked\u003C/code>. Set \u003Ccode>PRAGMA journal_mode=WAL\u003C/code> and \u003Ccode>PRAGMA busy_timeout=5000\u003C/code> and most of this goes away. WAL lets readers keep reading while someone writes. The busy timeout makes a writer wait instead of failing. Both should be on in any SQLite app that serves requests. Long transactions still hurt: one job that opens a transaction and then calls an external API holds the write lock the whole time.\u003C/p>\n\u003Cp>\u003Cstrong>More than one server.\u003C/strong> SQLite is a file. Two app servers can&#39;t share a file safely over the network, and SQLite&#39;s docs warn against network filesystems for exactly this. Once you need a second machine behind a load balancer, you either move to Postgres or to one of the replicated SQLite products, and at that point you&#39;ve added the complexity you picked SQLite to avoid.\u003C/p>\n\u003Cp>\u003Cstrong>Lots of small concurrent writes.\u003C/strong> Chat messages, counters, event logging from many users at once. Postgres handles concurrent writers with row-level locks, so two users updating two different rows don&#39;t wait for each other. SQLite makes them take turns for the whole database.\u003C/p>\n\u003Ch2>What you give up with SQLite (and what you don&#39;t)\u003C/h2>\n\u003Cp>Types are the thing that bites developers coming from Postgres. SQLite tables are flexibly typed by default: a column declared \u003Ccode>INTEGER\u003C/code> will happily store the string \u003Ccode>&#39;abc&#39;\u003C/code>. Since 3.37 you can declare a table \u003Ccode>STRICT\u003C/code> and get real type checks. I&#39;d do that on every new table, and I wish it were the default.\u003C/p>\n\u003Cp>Other gaps, in the order I&#39;d actually miss them:\u003C/p>\n\u003Cul>\n\u003Cli>No \u003Ccode>ALTER COLUMN\u003C/code>. Changing a column&#39;s type means the create-copy-drop-rename dance. Migration tools hide it, but it&#39;s slow on big tables.\u003C/li>\n\u003Cli>No row-level security, no roles, no \u003Ccode>LISTEN/NOTIFY\u003C/code>. One file, one permission: whoever can read the file can read everything.\u003C/li>\n\u003Cli>Extensions exist but the ecosystem is thinner. Postgres has \u003Ccode>pgvector\u003C/code>, PostGIS and full text search with ranking built in. SQLite has FTS5, which is honestly good, and vector extensions that are younger.\u003C/li>\n\u003Cli>Backups need thought. Copying the file while the app writes can give you a corrupt copy. Use the \u003Ccode>.backup\u003C/code> command or \u003Ccode>VACUUM INTO\u003C/code>, or stream it continuously with Litestream to S3.\u003C/li>\n\u003C/ul>\n\u003Cp>What you don&#39;t give up: JSON functions, window functions, CTEs, foreign keys (turn them on with \u003Ccode>PRAGMA foreign_keys=ON\u003C/code>, they&#39;re off by default, another bad default), and speed. A query against a local file with no network hop is very fast. For read-heavy pages SQLite often beats a Postgres that sits in another availability zone.\u003C/p>\n\u003Ch2>What Postgres costs you\u003C/h2>\n\u003Cp>Not much money. A small managed Postgres is cheap, and a self-hosted one on the same box as your app is free. The cost is moving parts: a server process to keep running and patch, connections to pool (I wrote about \u003Ca href=\"/blog/pgbouncer\">PgBouncer\u003C/a> for when that becomes a problem), a backup job that actually restores, and credentials to manage.\u003C/p>\n\u003Cp>Postgres 18 also made upgrades less painful than they used to be, and it added \u003Ccode>uuidv7()\u003C/code> so you get time-ordered IDs without an extension. Small things, but they add up to &quot;the default choice for anything with more than one writer&quot;.\u003C/p>\n\u003Cp>If you&#39;re comparing hosted Postgres options, the \u003Ca href=\"/blog/neon-vs-supabase\">Neon vs Supabase\u003C/a> post has the trade-offs, and \u003Ca href=\"/blog/mysql-vs-postgres\">MySQL vs Postgres\u003C/a> covers the other common question.\u003C/p>\n\u003Ch2>How I&#39;d decide\u003C/h2>\n\u003Cul>\n\u003Cli>A CLI tool, a desktop or mobile app, a single-server internal tool, a blog, a prototype: SQLite, with WAL, a busy timeout, foreign keys on and \u003Ccode>STRICT\u003C/code> tables.\u003C/li>\n\u003Cli>Anything with a queue worker writing a lot, a second app server on the roadmap, or multiple services touching the same data: Postgres from day one.\u003C/li>\n\u003Cli>Not sure? If moving later would scare you, start with Postgres. Moving from SQLite to Postgres is not hard for a small schema, but the flexible typing means you find out in the migration which rows had text in a number column.\u003C/li>\n\u003C/ul>\n\u003Cp>If you have an app that has outgrown its database, or you&#39;re picking one for a new build and want a second opinion, \u003Ca href=\"https://calendly.com/director-norsky/meeting\">book a free call\u003C/a>. All consultation is free.\u003C/p>\n",[16,20,24],{"slug":17,"title":18,"description":19},"cloudflare-d1","Cloudflare D1: Where It Fits and Where It Doesn't","Cloudflare D1 in November 2026: rows read and written pricing, the 10 GB database cap, one query at a time, Time Travel and read replicas.",{"slug":21,"title":22,"description":23},"postgres-vs-mongodb","Postgres vs MongoDB: Pick by the Questions You'll Ask Later","Postgres vs MongoDB in November 2026: Postgres 19 just shipped, MongoDB 8.3, JSONB vs documents, joins, transactions, licensing, and how I choose for a new app.",{"slug":25,"title":26,"description":27},"mysql-vs-postgres","MySQL vs Postgres: What Actually Bites You in 2026","MySQL vs Postgres in November 2026: MySQL 9.7 LTS and calendar versions, Postgres 19 RC, and the collation and migration surprises that bite when you switch.",1795910047825]