✓ 99.9% UPTIME ✓ 24/7 SUPPORT ✓ SINCE 2016 Status Looking Glass +92 312 6565434
Explainer · 2026-11-21 · Zain Ul Abddin

MySQL or PostgreSQL on a VPS: a practical chooser

Where each engine actually differs, memory sizing on a small server, backup and replication basics, and how to avoid the “one big box” mistake.

Database storage on enterprise drives

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 / MariaDBPostgreSQL
Default fitLAMP/WordPress, read-heavy appsComplex queries, JSON, analytics
JSONGood, less flexibleExcellent, indexable
ReplicationSimple primary/replicaStreaming + logical replication
ExtensionsFew, engine-boundPostGIS, pg_trgm, vector, many more
Ops familiarityUbiquitous in cPanel worldCommon 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.

Questions from readers

Is PostgreSQL faster than MySQL?

Not universally. For simple read-heavy workloads MySQL is often equal or faster; Postgres wins on complex queries, JSON and extensions.

How much RAM does a database need?

Enough to hold the working set. On a small VPS, 1 GB for the engine alongside PHP is typical; a dedicated box can use 50–70%.

Should the database be on its own server?

Once you have real traffic, yes. It isolates I/O, simplifies backups and prevents one workload starving the other.

Need this set up for you?

Managed VPS and Windows RDP from $12.50/mo, with the stack installed before handover.

Chat on WhatsApp See prices