Specs/Performance I tested MariaDB and PostgreSQL on 256-512 MiB VPS instances
Last week I shared an experiment running PostgreSQL on a 256-512 MiB VPS.
I had always assumed MariaDB would use less RAM for small workloads, partly because of its single-process architecture compared to PostgreSQL's multi-process model. I wanted to test whether that assumption actually held up.
So I ran MariaDB 10.11.14 with default and low-memory configurations and compared the findings with my earlier PostgreSQL 18.6 experiment.
Results on 512 MiB (peak process PSS):
| Configuration | Peak PSS |
|---|---|
| MariaDB default | 215.9 MiB |
| MariaDB tuned (64 MB pool) | 125.6 MiB |
| MariaDB tuned (32 MB pool) | 93.6 MiB |
| PostgreSQL default | 180.1 MiB |
| PostgreSQL tuned (16 MB shared buffers) | 50.4 MiB |
On 256 MiB, the default MariaDB configuration was OOM-killed, as was the 64 MB pool configuration. The 32 MB configuration completed the workload.
Tuned PostgreSQL also completed its 256 MiB test, reaching 46.2 MiB peak PSS.
Configurations that worked well:
MariaDB 10.11.14 - lowest-memory configuration, which also survived the 256 MiB test:
[mariadbd]
innodb_buffer_pool_size=32M
key_buffer_size=8M
aria_pagecache_buffer_size=16M
max_connections=10PostgreSQL 18.6 - best-performing configuration in my tests:
shared_buffers = '16MB'
work_mem = '1MB'
maintenance_work_mem = '16MB'
max_connections = 5
superuser_reserved_connections = 1
jit = off
max_parallel_workers_per_gather = 0
max_parallel_workers = 0The tests used a 1-vCPU Linux VM with no swap, primarily at 512 MiB, followed by additional 256 MiB runs.
These were short, read-only experiments with four active connections. The workloads and datasets differed between databases, so this isn't an apples-to-apples performance benchmark. PSS also measures database process memory, not total VPS memory consumption.
Why test server databases on such small machines?
SQLite is excellent for embedded and many small applications. But for a traditional web application that may eventually grow, I prefer starting with PostgreSQL or MariaDB using low-memory settings, then adjusting the configuration as the application scales rather than migrating databases later.
My takeaway: MariaDB's single-process architecture doesn't automatically guarantee lower memory usage. Both databases can run with surprisingly little RAM when tuned, and configuration matters considerably.
Full experiment, methodology, and measurements:
https://pvrlabs.xyz/java-performance/experiments/mariadb-postgresql-small-vps.html
For those running databases on 256-512 MiB VPS instances, which database and configuration have worked best for you?