Why I Chose SQLite Over PostgreSQL
Quick Answer
I chose SQLite over PostgreSQL because LockMargin is a desktop app that runs on the user's machine — not on a server. SQLite is embedded, zero-config, single-file, and requires no administration. PostgreSQL is a server database. For a freelancer who just wants to send an invoice, asking them to install PostgreSQL isn't a product. It's a sysadmin job.
The Decision Point
December 2025. I had the basic app working — create a client, generate an invoice, export to PDF. But I needed a database. Two options:
- SQLite — embedded, single-file, zero-config
- PostgreSQL — server-based, multi-user, enterprise-grade
I'd spent 20 years building systems with PostgreSQL. I knew it. I loved it. But I chose SQLite. Here's why.
The Conversation
I was leaning toward PostgreSQL. It's what I know. It's what I've used for factories, retail chains, service companies. It handles concurrency, transactions, complex queries. Why would I downgrade to SQLite?
Because you're not building a factory system anymore. You're building a desktop app for one person. PostgreSQL is a server. Where's the server going to run?
On the user's machine?
Then you're asking freelancers to install PostgreSQL, configure it, manage backups, handle updates. That's not a product. That's a sysadmin job. I wouldn't install it myself, and I'm a backend engineer. Imagine an accountant from Zhytomyr who last saw a command line in 2009.
Fair point. But SQLite — isn't it just for prototypes?
No. SQLite is in every phone, every browser, every operating system. It's the most deployed database in the world. Apple uses it. Google uses it. Every Android phone has dozens of SQLite databases. It's not a toy. It's a tool. I lost three days in 2019 trying to set up PostgreSQL replication for a startup that shut down a month later. SQLite would have saved those days.
What about concurrency? Multiple users?
Your app has one user. The freelancer. They're not sharing the database with 50 colleagues. SQLite handles single-user workloads perfectly. For multi-user, you'd need a server — which brings us back to PostgreSQL. But you don't want a server.
Right. Offline-first. No cloud. No server.
Exactly. SQLite is the database for offline-first apps. I'd say — for people who are tired of Docker Compose.
The Technical Comparison
Let's get specific. Here's how SQLite and PostgreSQL compare for LockMargin's use case:
| Dimension | SQLite | PostgreSQL |
|---|---|---|
| Installation | Zero (embedded) | Required (server) |
| Configuration | None | Complex (pg_hba.conf, postgresql.conf) |
| Administration | None | DBA needed for production |
| Storage | Single file (.db) | Multiple files, tablespaces |
| Backup | Copy the file | pg_dump, WAL archiving |
| Concurrency | Single-writer, multi-reader | Multi-writer, MVCC |
| Scalability | Limited to one machine | s? SQLite doesn't have built-in sync. For LockMargin, sync is a file copy (USB, cloud storage, etc.). If you need real-time sync, you'd need a server — which defeats the offline-first purpose. I copy the file. Not perfect. But works. Like everything else in this post. P.S. — Jon agreed to stay anonymous. But he's real. We had coffee at a cafe in Berlin in 2019. He said then: "All scaling problems are solved by not scaling." I didn't understand then. I did in December. The Bottom LineSQLite isn't a compromise. It's the correct choice for offline-first desktop apps. PostgreSQL is a server database. It's powerful, flexible, and enterprise-grade. But it requires a server, administration, and maintenance. For a freelancer who just wants to send invoices, that's overkill. SQLite is embedded, zero-config, single-file, and fast. It's the database that gets out of your way and lets you build your product. I chose SQLite because I wanted to build a tool, not a sysadmin job. And six months later, I'm glad I did. Ready to own your freelance data?Own your tools for $49 once → Read the Manifesto →Get the Client Data Protection Checklist — PDF, no email required. Not ready to own yet? Start is free — 5 clients, 5 projects a month, unlimited invoices. No subscription · No account required · Your data stays yours forever Get launch updatesOne email when Early Access opens. No spam, no newsletter. |