How to Choose Between Postgres, MySQL, and SQLite for a New Project

Picking a database for a new project is a decision you will live with for a while. The good news: for most new projects, any of the three usual choices works. Postgres vs MySQL vs SQLite is less about which one is best in general and more about which one fits the way your app stores data, how many people write to it at once, and where it runs. This guide compares the three on the points that actually change the decision, then gives you five questions that settle it.

Postgres vs MySQL vs SQLite at a Glance

Postgres and MySQL are server databases: your app connects to a running process, often on another machine. SQLite is a library: your app links it in and reads a single file on disk. That one difference drives most of the trade-offs below.

Feature PostgreSQL MySQL SQLite
Type Server database Server database Embedded library, single file
License PostgreSQL License, permissive GPL, commercial license available Public domain
Data model Relational, JSONB, arrays Relational, JSON type Relational, JSON functions
Concurrent writers Many at once Many at once One at a time
Full-text search Built in Built in FTS5 extension
Best fit Complex web apps, analytics Shared hosting, WordPress sites Mobile apps, desktop tools, tests
Scaling path Read replicas, partitioning Read replicas, sharding Migrate to a server database

Postgres: The Default for Most Web Apps

Postgres handles the widest range of workloads of the three, which is why it is the usual default for a new web app. Its SQL support is the most complete: window functions, common table expressions, and proper transaction handling all work the way the standard says they should. On top of that you get JSONB, a binary JSON type you can index and query like a table column, plus arrays, full-text search, and extensions such as PostGIS for maps and pgvector for embeddings.

That range matters in practice. A typical app starts with plain tables, then needs search, then stores a few JSON settings, then runs a monthly report. Postgres covers each step without adding another service. You still need to run and back up a server, but getting started takes minutes once you know how to install PostgreSQL on Ubuntu and secure it properly.

Pick Postgres when you are building a web app or API and you do not have a reason to pick something else. It is the choice that leaves the most doors open. The main cost is operational: someone has to keep the server patched and backed up, or you pay a managed provider to do it.

MySQL: The Safe, Familiar Pick

MySQL is the database most developers meet first. It powers WordPress, which means nearly every shared host offers it with one-click setup, and most PHP tutorials assume it. If your team already knows MySQL, or your hosting only gives you MySQL, that settles the Postgres vs MySQL question on its own. Familiarity is a real feature: your team debugs faster on a database they have operated before.

Technically, MySQL is a solid server database. InnoDB, the default storage engine, gives you transactions and row-level locking, and replication is well understood after decades in production. The main difference from Postgres is breadth: MySQL covers the common cases well, while Postgres goes further on advanced SQL, JSON, and extensions. For a standard CRUD app, that gap rarely shows up.

One practical note: on a small VPS the tuning matters more than the brand name. If you run MySQL on limited RAM, read our guide to MySQL vs PostgreSQL tuning for limited RAM before you blame the database for slow queries. If you have not settled the bigger question yet, our guide to choosing between SQL and NoSQL for a new project covers when a document store makes more sense than either one.

SQLite: The Zero-Setup Option

SQLite is not a server. It is a library your app links directly, and the whole database is one file on disk. There is nothing to install, no process to start, and no port to open. That makes it the easiest of the three to ship: copy the file and you have copied the database.

SQLite vs Postgres comes down to write concurrency. SQLite allows one writer at a time, so it fits apps where writes are rare or come from a single process: mobile apps, desktop tools, test suites, and small sites that mostly serve reads. Reads are fast, and write-ahead logging lets readers keep working while a write happens. But a web app with dozens of users saving at once will queue up behind that single writer, and that queue is the ceiling you will hit first.

Use SQLite when there is no server to run, or when you want the simplest thing that works for a local-first app. Move to Postgres or MySQL when concurrent writes grow, when you need access from several machines, or when the data outgrows one file. Migrating later is normal; SQLite even ships with a dump format that other databases can import.

How to Decide: Five Questions to Ask

There is no single best database for a new project, only the one that fits the project in front of you. Work through these five questions in order and the answer usually picks itself.

  1. How many writers at once? One writer, or a handful: SQLite is fine. Dozens of users writing at the same time: you need Postgres or MySQL.
  2. Where does it run? Shared hosting usually means MySQL. A VPS or cloud account means Postgres or MySQL. On a phone, laptop, or desktop with no server: SQLite.
  3. What kind of data? Plain rows and joins: any of the three. Heavy JSON, search, or analytics queries: Postgres has the edge with JSONB and full-text search. Simple key-value settings inside a larger app: SQLite handles it with no extra service.
  4. Who maintains it? If the team already runs MySQL in production, staying with MySQL saves more time than any feature gap costs.
  5. How much will it grow? Start with the simplest option that fits today. A side project does not need replicas on day one. When traffic grows, migrate: the cost of switching databases is real, but it is smaller than the cost of running infrastructure you do not need yet.

If nobody on the team wants to run a database server, compare managed database services before you decide.

Mistakes to Avoid When Picking a Database

The most common mistake is choosing by benchmark instead of by workload. A benchmark that shows one engine winning a synthetic test says little about your app and its own mix of reads, writes, and queries. Pick by the five questions above, not by a chart.

The second mistake is over-engineering. A new project does not need a cluster, a connection pooler, and a sharding plan before it has users. Start with one database, one server, and a backup. Add pieces when a real limit shows up.

The third mistake is skipping backups. Every database here can lose data if the disk dies and there is no copy. Set up automated backups on day one, and test a restore at least once. Finally, do not pick a database your host does not support well: a database that fights your deployment setup costs more time than any feature it adds. And when queries get slow, learn to debug a slow database query without guessing instead of assuming you picked the wrong engine.

FAQ

Can I switch databases later?

Yes. Moving between Postgres and MySQL means exporting the schema, moving the data, and rewriting queries that use database-specific features. It gets easier if you keep your SQL standard early on. Moving from SQLite to Postgres is simpler, since SQLite was often a stepping stone.

Is SQLite fine for production?

Yes, for the right workload. SQLite runs in production inside phones, browsers, airplanes, and plenty of small web apps. It breaks down when many users write at the same time, or when the database must live on a different machine from the app. Read-heavy and single-writer apps are its home turf.

Which one should a beginner learn first?

Postgres. Its SQL follows the standard closely, so what you learn transfers to other databases, and its feature set means you rarely need a second tool to finish a job. Learn the basics of tables, joins, and indexes first; the advanced features can wait until a project needs them.

For most new projects, Postgres is the safest default. MySQL wins when your hosting or your team already runs it. SQLite wins when there is no server to run. Pick the one that fits your project today, and migrate when the facts change.

Ditulis oleh

Firdaus Safari Putra

Founder, PT FirKaizen Digital Solutions

Firdaus Safari Putra adalah founder PT FirKaizen Digital Solutions. Ia membangun dan mengoperasikan infrastruktur server di balik panduan ini, dan menulis berdasarkan apa yang benar-benar ia jalankan, uji, dan ukur — bukan teori.