Both engines will run your app. The choice matters less than how you size and back up the box they sit on — but there are real differences worth knowing before you commit a schema.
Where they genuinely differ
| MySQL / MariaDB | PostgreSQL | |
|---|---|---|
| Default fit | LAMP/WordPress, read-heavy apps | Complex queries, JSON, analytics |
| JSON | Good, less flexible | Excellent, indexable |
| Replication | Simple primary/replica | Streaming + logical replication |
| Extensions | Few, engine-bound | PostGIS, pg_trgm, vector, many more |
| Ops familiarity | Ubiquitous in cPanel world | Common in app teams |
Memory: the number that decides
Databases are memory-bound before they are CPU-bound. On MySQL, innodb_buffer_pool_size should hold your working set — 50–70% of RAM on a dedicated database box. On Postgres, shared_buffers at 25% plus a healthy OS cache is the usual starting point.
On a 4 GB server that also runs PHP, do not hand 3 GB to the database. A realistic split for a small store: 1 GB to the engine, 1.5 GB to PHP workers, the rest to the OS.
The single-box trap
Running web and database on one VPS is fine to start. It becomes a problem when:
- a slow query starves PHP workers of CPU,
- backups lock tables during peak,
- one tenant's reporting job saturates I/O.
The first separation is usually not “bigger box” but “database on its own VPS, reached over a private network”. That also makes backups and restores independent.
Backups: logical and physical
A nightly mysqldump is fine for small databases and slow for large ones. For anything past a few gigabytes, use physical backups (Percona XtraBackup, pg_basebackup) and keep logical dumps for portability. Test the restore, not the job.
mysqldump --single-transaction --quick --routines --triggers mydb | gzip > /backup/mydb-$(date +%F).sql.gz
pg_dump -Fc mydb > /backup/mydb-$(date +%F).dump
Which should you pick
Choose MySQL/MariaDB if you run WordPress, cPanel, or a team already comfortable with it. Choose PostgreSQL if you need JSON queries, extensions like PostGIS, or your app framework defaults to it (Laravel, Django, Rails all support both).
Do not migrate an engine mid-project for performance reasons alone. Measure first: slow query logs and EXPLAIN usually point at missing indexes, not the wrong engine.
What we do
We install either engine tuned to the plan, bind it to localhost or a private network, and set a backup rotation with a restore test. For stores, we often recommend a separate database VPS once order volume passes a few thousand a month. See database server setup.