eco Beginner Use Case Guide

Dedicated Server for PostgreSQL and MySQL Hosting

We earn commissions when you shop through the links below.

calendar_month Oct 28, 2026 schedule 9 min read visibility 505 views
Dedicated Server for PostgreSQL and MySQL Hosting

A dedicated server with 8 CPU cores, 32 GB RAM, and mirrored NVMe storage is a strong starting point for sustained PostgreSQL or MySQL workloads above 200 active connections. A VPS is sufficient for smaller databases and single applications, but bare metal provides predictable CPU, memory, disk I/O, and network isolation for production systems. This guide covers sizing, installation, security, tuning, backups, and migration planning.

dns No server for this guide yet? Vultr, Contabo, UltaHost sellDeal WebHosting UK: 10% off dedicated servers until Nov 30 Get deal →

Why host PostgreSQL or MySQL on a dedicated server?

PostgreSQL and MySQL are often limited by storage latency, memory pressure, CPU contention, or connection volume rather than raw network bandwidth. A dedicated server assigns the database its own physical CPU cores, RAM, NVMe devices, and network interface. That isolation reduces performance variation caused by neighboring workloads on a shared virtualization host.

Bare metal is particularly useful for transactional applications, analytics, ecommerce, SaaS platforms, game backends, mail systems, and self-hosted applications that issue many small reads and writes. PostgreSQL benefits from large memory allocations for its shared buffers and operating-system page cache. MySQL, especially with InnoDB, also uses RAM to keep indexes and frequently accessed data away from slower storage.

When a VPS is enough

A VPS is a sensible choice for development, staging, a small business website, a low-traffic API, or one self-hosted application. A 4 vCPU VPS with 8 GB RAM and 80 GB NVMe storage can handle many small databases when queries are indexed and backups are scheduled outside peak traffic.

  • Development and testing databases
  • WordPress, Laravel, Django, and similar sites with moderate traffic
  • Small game backends and internal dashboards
  • Monitoring, automation, and self-hosted applications
  • Databases below roughly 100 GB with fewer than 50 active connections

Choose a VPS when cost efficiency and fast provisioning matter more than strict performance isolation. Confirm that the plan includes dedicated or guaranteed vCPU resources if query latency is important.

When to move to dedicated hardware

Move to a dedicated server when the database has sustained CPU or disk activity, the working set no longer fits comfortably in RAM, or latency varies during neighboring workloads. Dedicated hardware is also appropriate when compliance, tenant isolation, predictable recovery times, or direct control over disks is required.

  • More than 200 active database connections or high connection churn
  • Large write-heavy workloads, frequent updates, or heavy index maintenance
  • Databases from 500 GB to multiple terabytes
  • Analytics queries running beside transactional traffic
  • Replication, read replicas, point-in-time recovery, or database clustering
  • Production services where a storage performance spike can affect revenue

A dedicated server does not automatically make inefficient SQL fast. It gives the database enough predictable resources to expose and solve query, schema, and configuration problems without virtualization noise.

Recommended dedicated server specifications

CPU

Start with 8 modern physical cores for a production database serving a medium application. PostgreSQL can parallelize some analytical queries, while MySQL commonly benefits from strong per-core performance for transactional workloads. For many short transactions, faster cores and adequate RAM are usually more useful than a large number of slow cores.

Use 12 to 16 physical cores for mixed OLTP and reporting workloads, many concurrent queries, or several databases on the same host. Avoid selecting a CPU solely by core count; check clock speed, cache, generation, and whether all advertised cores are physical.

dnsA server for this guide

Matching plans from verified providers, prices updated daily.

sell WebHosting UK: 10% off dedicated servers · until Nov 30 Get deal →

Compare:Vultr vs ContaboVultr vs UltaHostAll dedicated servers

Affiliate links: we may earn a commission, your price stays the same.

Memory

Use at least 16 GB RAM for a small production database and 32 GB for a medium dedicated deployment. RAM should cover the database working set, operating-system cache, connection overhead, replication processes, backup buffers, and monitoring agents.

For PostgreSQL, a common starting point is shared_buffers near 25% of system RAM, followed by measurement and adjustment. For MySQL, set innodb_buffer_pool_size near 60% to 70% of RAM on a dedicated database host, leaving space for connections, temporary tables, the operating system, and backup tools. These are starting points, not universal values.

Storage

Use enterprise NVMe SSDs for latency-sensitive databases. Prefer two or more drives in a mirrored arrangement so one device can fail without immediately taking the database offline. A 2 x 960 GB or 2 x 1.92 TB mirror provides useful capacity and redundancy, but RAID is not a backup.

Check the provider's storage details: sustained write performance, endurance rating, power-loss protection, RAID controller behavior, and replacement procedures matter more than sequential benchmark numbers. Database workloads often produce random synchronous writes, so latency under load is a key metric.

Network and bandwidth

A 1 Gbps port is adequate for most application databases because application traffic usually does not consume the full link. Select at least 5 TB monthly transfer for a medium deployment and 10 TB or more for replication, remote backups, large exports, or multiple application servers. Keep backup traffic on a private network when available, and encrypt all traffic that crosses public networks.

Scale-to-spec sizing table

For up to 50 active connections and a 100 GB database, a 4-vCPU VPS is enough; past 200 active connections or 500 GB, use an 8-core dedicated server with mirrored NVMe.

Active connections and database sizevCPU or CPURAMDiskMonthly bandwidth
Up to 50 connections; up to 100 GB4 vCPU8 GB80 GB NVMe2 TB
50-200 connections; 100-500 GB8 physical cores32 GB2 x 960 GB enterprise NVMe RAID 15 TB
200-1,000 connections; 500 GB-2 TB16 physical cores64 GB2 x 1.92 TB enterprise NVMe RAID 110 TB

These figures assume indexed queries, a correctly configured connection pool, and normal application traffic. A database with complex analytics, unindexed searches, or high-frequency writes may need more CPU, RAM, or separate read and reporting servers.

Step-by-step setup

1. Prepare and secure the operating system

Install a supported 64-bit Linux distribution such as Ubuntu Server 24.04 LTS or Debian 12. Use SSH keys, disable password authentication after testing, create a non-root administrator, and apply updates before installing database software.

sudo apt update && sudo apt full-upgrade -y
sudo adduser dbadmin
sudo usermod -aG sudo dbadmin
sudo systemctl enable --now systemd-timesyncd

Set the hostname and verify time synchronization. Accurate time is required for useful logs, certificates, replication diagnostics, and incident timelines.

2. Install the database engine

Install one database engine per workload unless there is a clear operational reason to run both. PostgreSQL and MySQL can coexist, but they compete for RAM, cache, CPU, and storage. Use the vendor-supported repository when you require a specific major version.

sudo apt install -y postgresql postgresql-contrib
sudo systemctl enable --now postgresql
sudo apt install -y mysql-server
sudo systemctl enable --now mysql

Do not expose both database services to the public internet by default. Bind them to localhost or a private interface, then permit only trusted application addresses.

3. Create least-privilege database accounts

Create separate accounts for applications, migrations, reporting, and administration. Avoid using the PostgreSQL postgres account or MySQL root account in application configuration.

sudo -u postgres createuser --pwprompt appuser
sudo -u postgres createdb -O appuser appdb
sudo mysql -e "CREATE DATABASE appdb CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci; CREATE USER 'appuser'@'10.0.0.%' IDENTIFIED BY 'REPLACE_WITH_A_LONG_SECRET'; GRANT ALL PRIVILEGES ON appdb.* TO 'appuser'@'10.0.0.%'; FLUSH PRIVILEGES;"

Use a secret manager or protected environment file for credentials. Restrict MySQL host patterns and PostgreSQL rules to the application's private subnet rather than allowing % from public interfaces.

4. Configure firewall access

Allow SSH only from an administration network when possible. PostgreSQL uses TCP port 5432 and MySQL uses TCP port 3306. Permit these ports only from application servers, VPN addresses, or a private VLAN.

sudo apt install -y ufw
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow from 10.0.0.0/24 to any port 22 proto tcp
sudo ufw allow from 10.0.0.0/24 to any port 5432 proto tcp
sudo ufw allow from 10.0.0.0/24 to any port 3306 proto tcp
sudo ufw enable
sudo ufw status verbose

5. Tune configuration from measurements

Set PostgreSQL shared_buffers, effective_cache_size, work_mem, maintenance_work_mem, and checkpoint settings based on workload and RAM. Set MySQL's innodb_buffer_pool_size, redo log capacity, connection limit, and temporary table limits carefully. Restart or reload only after validating syntax and retaining the previous configuration.

Use a connection pool such as PgBouncer for PostgreSQL or an application-level pool for MySQL. Hundreds of idle client connections can consume substantial memory and create unnecessary process or thread overhead. Pool sizes should be based on measured query concurrency, not simply the number of web workers.

6. Add backups and test restoration

Use full backups, incremental or WAL/binlog-based recovery where appropriate, and a copy stored on separate infrastructure. Encrypt backups in transit and at rest. A backup that has never been restored is an assumption, not a recovery plan.

sudo -u postgres pg_dump -Fc appdb > /var/backups/appdb-$(date +%F).dump
sudo mysqldump --single-transaction --routines --triggers appdb | gzip > /var/backups/appdb-$(date +%F).sql.gz

Schedule backups with systemd timers or a managed backup tool, monitor exit codes, and perform a restore drill at least monthly for important systems. Keep enough retention to recover from accidental deletion, application bugs, and ransomware.

7. Monitor before declaring the server ready

Track CPU utilization, load, RAM pressure, swap activity, disk latency, IOPS, filesystem capacity, database connections, cache hit ratios, replication lag, slow queries, and backup age. PostgreSQL's pg_stat_statements and MySQL's Performance Schema help identify expensive queries.

sudo apt install -y sysstat iotop
sudo systemctl enable --now sysstat
sudo iostat -xz 5

Alert before capacity is exhausted: disk usage above 80%, persistent swap activity, replication lag, failed backups, and storage latency spikes deserve investigation.

Performance optimization

  • Index for actual query patterns: use EXPLAIN and EXPLAIN ANALYZE to find sequential scans, poor joins, and excessive sorting. Remove redundant indexes that slow writes.
  • Keep transactions short: long transactions prevent vacuum cleanup in PostgreSQL and can retain locks or undo history in MySQL.
  • Use pooling: cap application connections and queue excess work rather than opening one database connection per request.
  • Separate workloads: move reporting queries to a read replica or a separate analytics system when they interfere with transactional traffic.
  • Maintain tables: configure PostgreSQL autovacuum and analyze schedules; use appropriate MySQL statistics and optimize only after evidence shows fragmentation or inefficient plans.
  • Protect storage: leave free space for temporary files, WAL, binlogs, compaction, and maintenance. Avoid filling a database filesystem beyond 80%.
  • Use private networking: place application servers and replicas on a private network to reduce exposure and avoid unnecessary public transfer.
  • Benchmark safely: use pgbench, sysbench, or a production-like staging dataset. Never run destructive tests against production without a tested rollback plan.

Common pitfalls to avoid

Exposing the database to the internet

Publicly reachable port 5432 or 3306 invites credential attacks and scanning. Use firewall allowlists, private networking, VPN access, TLS, strong passwords, and certificate-based authentication where practical.

Treating RAID as a backup

RAID protects against some disk failures but does not protect against accidental deletes, corruption, compromised credentials, or application errors. Keep independent, encrypted, tested backups.

Overallocating memory

Setting PostgreSQL work memory or MySQL per-connection buffers too high can cause out-of-memory events when many queries run at once. Calculate worst-case concurrent usage and leave RAM for the kernel, cache, monitoring, and backups.

Ignoring connection management

Raising max_connections can make a busy system less stable. Use pooling, fix connection leaks, and inspect idle sessions before increasing limits.

Choosing capacity from database size alone

A 50 GB database with heavy writes can require more IOPS than a 500 GB archive. Measure read/write latency, queries per second, transaction rate, working-set size, and peak concurrency before finalizing hardware.

Skipping version and migration planning

Pin major versions, test extensions and character sets, document schema migrations, and maintain a rollback plan. PostgreSQL and MySQL major upgrades can change query plans, authentication defaults, and replication behavior.

VPS or dedicated server: practical decision

Use a VPS for a small, well-indexed database with predictable traffic and a working set that fits in 8 GB RAM. Choose dedicated hardware for sustained production I/O, databases above 500 GB, mixed workloads, strict isolation, or recovery and replication requirements. A VPS or dedicated server should be sized around measured connections, storage latency, database growth, and backup requirements rather than selecting hardware by database size alone.

table_chart VPS and dedicated database hosting compared

Option vCPU RAM Storage Best for
4-vCPU VPS 4 vCPU 8 GB 80 GB NVMe Up to 50 active connections and 100 GB
8-core dedicated server 8 physical cores 32 GB 2 x 960 GB enterprise NVMe RAID 1 50-200 active connections and 100-500 GB
16-core dedicated server 16 physical cores 64 GB 2 x 1.92 TB enterprise NVMe RAID 1 200-1,000 active connections and 500 GB-2 TB

Affiliate links: we may earn a commission, your price stays the same.

check_circle Conclusion

A 4-vCPU VPS is suitable for smaller PostgreSQL and MySQL deployments, while sustained workloads above 200 active connections or 500 GB generally justify an 8-core or larger dedicated server with mirrored enterprise NVMe. Choose a VPS or bare-metal server, then build in private networking, tested backups, least-privilege access, and monitoring from the first deployment.

help Frequently Asked Questions

Was this guide helpful?

Your feedback helps us improve our guides.

Share this post:

Send this guide to someone who may find it useful.

Telegram VKVK WhatsApp Facebook LinkedIn XX

dedicated server for PostgreSQL dedicated MySQL server PostgreSQL bare metal hosting MySQL database server hosting database server specifications