Database workloads have different resource priorities than typical web hosting — RAM and disk I/O speed usually matter far more than raw CPU count. This guide helps you size a VPS correctly for MySQL, PostgreSQL, MongoDB, or Redis.
RAM: The Most Important Resource
Databases perform best when frequently accessed data fits in memory (via the buffer pool/cache), avoiding slower disk reads. As a starting guideline:
| Database Size | Suggested Minimum RAM |
|---|---|
| Under 1 GB | 2 GB |
| 1–10 GB | 4–8 GB |
| 10–50 GB | 8–16 GB |
| 50 GB+ | 16 GB+ (consider a dedicated database VPS) |
Storage: NVMe Over Standard SSD
Databases perform many small, frequent read/write operations. NVMe storage's significantly higher IOPS (input/output operations per second) compared to standard SSD directly translates into faster query response times under real load.
CPU: Matters Less Than Expected
Unless you're running heavy analytical queries or aggregations, most database workloads are I/O and memory bound rather than CPU bound. 2–4 vCPUs is sufficient for many small-to-medium applications.
Dedicated Database VPS vs Combined with Application
| Approach | Pros | Cons |
|---|---|---|
| Same VPS as app | Simpler, cheaper for small projects | App and database compete for resources |
| Dedicated database VPS | Predictable performance, easier to scale independently | Higher cost, requires securing network access between servers |
Signs Your Database Needs More Resources
- Slow query log filling up with previously fast queries — see How to Tune MySQL/MariaDB Performance for a VPS
- High disk I/O wait time in
iostat - Buffer pool hit ratio dropping (frequent disk reads instead of memory reads)
- Connection timeouts under normal (not peak) load
Checking Current Database Size
MySQL/MariaDB:
SELECT table_schema AS "Database",
ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS "Size (MB)"
FROM information_schema.tables GROUP BY table_schema;
PostgreSQL:
SELECT pg_size_pretty(pg_database_size('myapp'));
When to Separate the Database onto Its Own VPS
Consider a dedicated database server once your application VPS shows resource contention between the web server and database under load, or once you need independent scaling/backup schedules for each.
FAQ
Should I always use a separate VPS for my database?
Not necessarily for small projects — combining app and database on one VPS is fine until you observe actual resource contention; separating early adds operational complexity without guaranteed benefit for low-traffic workloads.
Related Articles
- How to Choose the Right VPS Plan for Your Workload
- How to Tune MySQL/MariaDB Performance for a VPS
- MySQL vs PostgreSQL vs MongoDB vs Redis: Which Database Should You Use?
