Skip to content
VDS · Databases

Configuring database memory for your tier

Specific buffer values for PostgreSQL and MySQL for VDS-1…VDS-6, and a rule for distributing memory between the database, application, and system.

Updated August 23, 2026

Default database settings are designed to start anywhere, not to run fast. On VDS-3 with 8 GB of memory, PostgreSQL out of the box uses 128 MB for cache — meaning it reads almost everything from disk, even though it could read from memory.

Allocation rule

Split the tier's memory roughly like this:

  • system and service processes — 10–15%;
  • the application (PHP-FPM, Node, gunicorn) — by the number of workers;
  • the database — whatever is left, but no more than 60–70% of total memory.

Never give the database all the memory: the system will go into swap, and NVMe won't help you — latency will grow tens of times over.

How much is in use right now:

free -h
ps -eo pmem,rss,comm --sort=-rss | head

Memory graphs for an hour, a day, a week, and a month are available in the "Overview" of the panel /hosting/vds/m/<id> — they show the real peak, not the current moment.

PostgreSQL

/etc/postgresql/17/main/postgresql.conf:

Tiershared_bufferseffective_cache_sizework_memmaintenance_work_memmax_connections
VDS-1 (2 GB)384MB1GB8MB96MB40
VDS-2 (4 GB)1GB2GB12MB256MB60
VDS-3 (8 GB)2GB5GB16MB512MB100
VDS-4 (16 GB)4GB10GB24MB1GB150
VDS-5 (24 GB)6GB16GB32MB2GB200
VDS-6 (32 GB)8GB22GB48MB2GB250

Plus the general NVMe settings:

random_page_cost = 1.1
effective_io_concurrency = 200

work_mem is allocated per sort operation, not per connection: a hundred parallel queries with complex sorting will multiply it hundreds of times over. Don't set it too high.

Applying: systemctl restart postgresql (changing shared_buffers requires a restart specifically).

MySQL and MariaDB

Tierinnodb_buffer_pool_sizeinnodb_log_file_sizemax_connections
VDS-1512M128M60
VDS-21G256M100
VDS-33G512M150
VDS-48G1G200
VDS-512G1G250
VDS-618G2G300
innodb_flush_method = O_DIRECT
innodb_flush_log_at_trx_commit = 1
innodb_io_capacity = 2000

The buffer pool is the main parameter: if it fits the working data set, the disk is barely read.

Checking the effect

SELECT sum(blks_hit)*100/sum(blks_hit+blks_read) FROM pg_stat_database;

For MySQL, look at SHOW ENGINE INNODB STATUS and the ratio of Innodb_buffer_pool_reads to Innodb_buffer_pool_read_requests. A cache hit rate below 95% means the database doesn't have enough memory.

Common mistakes

SymptomCause
The database won't start after an editMore memory requested than is available — check the journal
The process was killed by OOMThe database, application, and system together exceed the tier's memory
It got slower after "optimization"work_mem is set too high, the machine is swapping
The disk is constantly being readThe buffers are too small, the working set doesn't fit

If you're still hitting a wall after tuning memory, the problem is the amount of data, not the config. You can only upgrade your plan, with a prorated payment for the remaining days of the paid term; downgrades aren't available, so choose the next tier deliberately.