PostgreSQL vs SQLite — When to Use a Tank vs a Swiss Army Knife
PostgreSQL is for serious apps that need ACID and scale; SQLite is for embedded, local, or prototyping where simplicity wins. Pick based on your deployment, not features.
PostgreSQL
PostgreSQL clinches it because it's a full-featured, ACID-compliant database that scales from small apps to enterprise workloads. If you're building anything that needs concurrent writes, complex queries, or might grow beyond a single file, PostgreSQL is the only sane choice.
These Aren't Even in the Same Weight Class
Comparing PostgreSQL to SQLite is like comparing a main battle tank to a Swiss Army knife — they're built for entirely different battlefields. PostgreSQL is a full-fledged, client-server relational database management system (RDBMS) that handles multiple concurrent users, complex transactions, and terabytes of data. SQLite is a serverless, self-contained, file-based database engine that runs in-process with your app. PostgreSQL is for when you need a database; SQLite is for when you need a data store that's just there, no setup required. The real question isn't which is better, but which is less wrong for your specific use case.
Where PostgreSQL Wins
PostgreSQL wins on everything that matters for production apps: ACID compliance with full transaction support, concurrent write operations (SQLite locks the entire database on writes), and advanced features like JSONB, full-text search, and geospatial extensions. It scales vertically and horizontally, supports replication out of the box, and has a rich ecosystem of tools like pgAdmin and PostGIS. If you need to handle more than one user writing at the same time, or you're building a web app with more than a few hundred daily active users, PostgreSQL is non-negotiable.
Where SQLite Holds Its Own
SQLite's strength is its absurd simplicity and zero-configuration deployment. It's serverless — just a library you link into your app — which means no database server to manage, no network latency, and no separate process to fail. It's perfect for embedded systems (think IoT devices, mobile apps), local development where you don't want to run a full DB server, and prototyping where you just need to persist data without the overhead. SQLite is also public domain, so you can use it anywhere without licensing headaches. For read-heavy, single-user scenarios, it's often more than enough.
The Gotcha: Concurrency and Scale
The biggest surprise for developers coming from SQLite to PostgreSQL is how much they've been missing: SQLite locks the entire database file on writes, meaning concurrent writes are a bottleneck. PostgreSQL handles this with row-level locking and MVCC (Multi-Version Concurrency Control). Conversely, moving from PostgreSQL to SQLite means giving up features like stored procedures, triggers beyond basics, and foreign data wrappers. The hidden friction? If you start with SQLite and your app grows, migrating to PostgreSQL isn't trivial — you'll need to export data, rewrite queries that use SQLite-specific syntax, and set up a whole new infrastructure.
If You're Starting Today...
If you're building a web app, SaaS product, or anything that will have more than one user writing data concurrently, start with PostgreSQL. Use a managed service like Supabase (free tier: 500 MB database) or AWS RDS (free tier: 750 hours/month) to avoid setup headaches. If you're building a mobile app (iOS/Android), a desktop application, or a simple script that needs local data storage, use SQLite. It's built into most platforms, and you can ship it as a single file. Don't overthink it — pick the tool that matches your deployment model, not your feature checklist.
What Most Comparisons Get Wrong
Most comparisons obsess over feature lists and ignore the elephant in the room: SQLite isn't a replacement for PostgreSQL in server environments. They'll say 'SQLite supports JSON' or 'SQLite has transactions' but gloss over the fact that SQLite's write scalability falls off a cliff with multiple users. The real question isn't 'which is better?' but 'where will this database live?' If it's on a single machine with one writer, SQLite might work. If it's on a server with multiple concurrent writers, PostgreSQL is your only option. Stop comparing apples to armored personnel carriers.
Quick Comparison
| Factor | PostgreSQL | SQLite |
|---|---|---|
| Deployment Model | Client-server, requires running a database server process | Serverless, runs in-process as a library |
| Concurrent Writes | Full support with row-level locking and MVCC | Locks entire database file on writes, limited concurrency |
| ACID Compliance | Full ACID with robust transaction support | ACID-compliant but with file-level locking limitations |
| Setup Complexity | Requires installation, configuration, and server management | Zero-configuration, just include the library |
| Cost | Free and open-source (PostgreSQL License), managed services start at ~$10/month | Public domain, completely free |
| Scalability | Scales to terabytes, supports replication and clustering | Limited to single-file (max 281 TB theoretically, but practically much less) |
| Use Case Sweet Spot | Web apps, enterprise systems, multi-user applications | Embedded devices, mobile apps, local development |
| Advanced Features | JSONB, full-text search, geospatial (PostGIS), foreign data wrappers | Basic JSON support, full-text search via extensions, limited geospatial |
The Verdict
Use PostgreSQL if: You're building a web app, SaaS, or any multi-user system that needs concurrent writes and might scale beyond a single server.
Use SQLite if: You're developing a mobile app, desktop application, IoT device, or need a simple local database for prototyping with zero setup.
Consider: MySQL if you need a lighter-weight server database than PostgreSQL but still require concurrent writes — it's less feature-rich but often faster for simple queries.
PostgreSQL clinches it because it's a full-featured, ACID-compliant database that scales from small apps to enterprise workloads. If you're building anything that needs concurrent writes, complex queries, or might grow beyond a single file, PostgreSQL is the only sane choice.
Related Comparisons
Disagree? nice@nicepick.dev