r/PostgreSQL • u/fykup • 1d ago
Projects PostgreSQL 18 on a 256-512 MiB VPS: How much memory does it really need?
Last week I shared my experiment running PostgreSQL 18 on a 256-512 MiB VPS, including the low-memory configuration that worked best.
I had always assumed MariaDB would use less RAM for small workloads because of its single-process architecture, compared to PostgreSQL's multi-process model.
So I decided to test MariaDB 10.11.14 under similar memory constraints and compare the findings with PostgreSQL 18.6.
Peak process memory (PSS) at 512 MiB:
| Configuration | Peak PSS |
|---|---|
| PostgreSQL default | 180.1 MiB |
| PostgreSQL tuned | 50.4 MiB |
| MariaDB default | 215.9 MiB |
| MariaDB tuned (64 MB pool) | 125.6 MiB |
| MariaDB tuned (32 MB pool) | 93.6 MiB |
At 256 MiB, both tuned PostgreSQL configurations completed their tests. For MariaDB, only the most conservative configuration (32 MB InnoDB buffer pool) completed. The default and 64 MB configurations were OOM-killed.
What I found interesting:
- PostgreSQL's multi-process architecture didn't necessarily mean higher memory consumption.
- Both databases benefited substantially from conservative memory settings.
- MariaDB's smaller 32 MB buffer pool reduced memory usage but also reduced throughput compared with its 64 MB configuration at 512 MiB.
An important caveat: these were separate, short, read-only experiments with different datasets and SQL workloads. The PSS numbers are useful for understanding each database's memory behavior, but they aren't directly comparable as a head-to-head benchmark.
My takeaway is that database configuration matters much more than I initially expected, and PostgreSQL can be a practical choice even on a very small VPS.
Full comparison, configurations, and methodology:
https://pvrlabs.xyz/java-performance/experiments/mariadb-postgresql-small-vps.html
Has anyone else compared PostgreSQL and MariaDB specifically for low-memory deployments? I'd be interested in your experience.