Introduction
Every hosting decision ultimately comes down to the database. You can have the fastest NVMe storage, the lowest-latency network, and the most generous RAM allocation โ but if your database engine chokes under load, your application suffers.
At Hostingowy, we run both PostgreSQL and MySQL (via MariaDB) across our bare-metal infrastructure for hundreds of customer workloads. This piece isn't theoretical โ it's what we've learned tuning both engines in European data centres (Poland).
The Short Answer
If you need complex queries, JSON operations, geospatial data, or strict ACID compliance, choose PostgreSQL. If you need simple read-heavy workloads, WordPress compatibility, or minimal administration overhead, choose MySQL/MariaDB. Both are excellent โ but they excel in different scenarios.
Performance Benchmarks
We benchmarked both databases on identical Hostingowy dedicated server hardware:
- CPU: AMD EPYC 7452 (32 cores)
- RAM: 128GB DDR4 ECC
- Storage: 2ร Samsung PM9A3 NVMe (ZFS, RAID-1)
- OS: Ubuntu 24.04 LTS
- PostgreSQL 16 vs MySQL 8.0 / MariaDB 11.4
Read-Only Workload (SELECT benchmarks)
| Benchmark | PostgreSQL 16 | MySQL 8.0 | MariaDB 11.4 |
|---|---|---|---|
| Simple SELECT (1M rows) | 23,400 qps | 28,100 qps | 29,200 qps |
| Complex JOIN (6 tables) | 8,200 qps | 5,400 qps | 6,100 qps |
| Full-text search (500K docs) | 3,100 qps | 4,200 qps | 4,500 qps |
| JSON query (nested path) | 12,600 qps | 3,800 qps | 2,100 qps |
Write-Only Workload (INSERT/UPDATE)
| Benchmark | PostgreSQL 16 | MySQL 8.0 | MariaDB 11.4 |
|---|---|---|---|
| Single-row INSERT | 18,500 tps | 22,300 tps | 24,100 tps |
| Bulk INSERT (10K rows) | 142,000 rows/s | 189,000 rows/s | 201,000 rows/s |
| UPDATE with index | 12,100 tps | 14,800 tps | 15,200 tps |
| Transactional (BEGIN/COMMIT per row) | 9,800 tps | 6,200 tps | 7,100 tps |
When to Choose PostgreSQL
1. Complex Query Workloads
PostgreSQL's query planner is significantly more sophisticated than MySQL's. If your application uses window functions, CTEs (WITH clauses), recursive queries, or advanced aggregations, PostgreSQL will outperform MySQL by a wide margin โ sometimes 2-3x on complex analytical queries.
2. JSON and NoSQL Workloads
PostgreSQL's JSONB type is a first-class citizen with GIN indexing, path queries, and partial updates. MySQL added JSON support in 5.7, but it still lags behind in performance โ our benchmarks show PostgreSQL handles nested JSON path queries 3x faster than MySQL and 6x faster than MariaDB.
3. Geospatial Data
PostgreSQL with PostGIS extensions is the gold standard for geospatial workloads. MySQL's spatial support is functional but limited โ if you're building location-aware applications, PostgreSQL is the clear choice.
4. Strict ACID Compliance
PostgreSQL's MVCC implementation is more mature than MySQL's. Under high concurrency (100+ simultaneous connections), PostgreSQL maintains consistent read performance while MySQL's performance degrades due to its gap lock implementation and index contention.
When to Choose MySQL / MariaDB
1. WordPress and LAMP Stack
WordPress runs on MySQL. Period. While it's technically possible to run WordPress on PostgreSQL via a compatibility layer, it's not recommended for production. If you're managing WordPress hosting, MySQL or MariaDB is the practical choice. See our WordPress performance tuning guide for optimization tips.
2. Read-Heavy Applications
MySQL's storage engine architecture (InnoDB) gives it an edge in simple read-heavy workloads. For content management systems, e-commerce catalogs, and blog platforms where most queries are simple SELECT statements, MySQL delivers 15-25% better throughput than PostgreSQL.
3. Replication Simplicity
MySQL's native replication is simpler to configure and manage than PostgreSQL's. For small to medium deployments where you need a read replica without complex tooling, MySQL's built-in asynchronous replication is hard to beat.
4. Management Tooling
phpMyAdmin, Adminer, and MySQL Workbench provide mature GUI management. While pgAdmin is capable, the ecosystem of MySQL management tools is more extensive and familiar to system administrators.
Replication and High Availability
| Feature | PostgreSQL | MySQL/MariaDB |
|---|---|---|
| Streaming replication | โ Built-in (synchronous/async) | โ Built-in (async/semi-sync) |
| Multi-master replication | โ (via pglogical/BDR) | โ MariaDB Galera cluster |
| Logical replication | โ Native (decoding) | โ Binlog-based |
| Automatic failover | โ Patroni / pg_auto_failover | โ Orchestrator / MySQL InnoDB Cluster |
| Point-in-time recovery | โ WAL archiving | โ Binlog replay |
| Sharding | โ Postgres-XL / Citus | โ Vitess / ProxySQL |
Memory and Resource Usage
On our bare-metal benchmarking nodes, we observed the following baseline memory usage (idle, fresh install, default config):
- PostgreSQL 16: ~180MB resident
- MySQL 8.0: ~420MB resident
- MariaDB 11.4: ~280MB resident
PostgreSQL's memory allocation is more conservative at idle, but both engines will use as much memory as you give them for caching. PostgreSQL's shared_buffers and MySQL's innodb_buffer_pool_size should typically be set to 25-40% of available RAM for dedicated database servers.
UK Hosting Considerations
For UK businesses, data residency is increasingly important. Both PostgreSQL and MySQL handle UK GDPR requirements equally well โ the key is choosing the right hosting provider. Read our UK GDPR hosting compliance guide for details on data protection requirements.
At Hostingowy, we are a UK-headquartered company with infrastructure in European data centres (Poland), ensuring GDPR compliance and low-latency connectivity for UK customers. We support both PostgreSQL and MySQL on all VPS and dedicated server plans.
Migration Between Databases
If you're considering switching from MySQL to PostgreSQL (or vice versa), here's what you need to know:
- MySQL โ PostgreSQL: Use pgloader for automatic migration. It handles schema conversion, data types, and indexes. Expect some manual SQL tweaking for stored procedures.
- PostgreSQL โ MySQL: Use MySQL Workbench migration wizard. You'll need to rewrite complex queries and handle data type differences (particularly arrays, JSONB, and enums).
- Zero-downtime approach: Set up logical replication between both engines, run dual-writes during transition, then cut over.
Our Recommendation
For most UK hosting workloads on VPS or dedicated servers:
- WordPress / PHP applications: MariaDB 11.4 โ best performance, MySQL compatibility, active open-source development
- Python / Django / Ruby on Rails: PostgreSQL 16 โ native support, superior ORM integration
- Java / Spring Boot: Either โ both are well-supported, choose based on query complexity
- Node.js / Express: PostgreSQL 16 โ JSONB, async-friendly drivers, better concurrent connection handling
- E-commerce (WooCommerce, Magento): MariaDB 11.4 โ see our WooCommerce hosting guide
Conclusion
There's no universal "best" database engine โ the right choice depends on your workload, team expertise, and scalability requirements. Both PostgreSQL and MySQL are battle-tested, production-grade databases that will serve you well on properly provisioned hardware.
The most important factor? Having reliable, European bare-metal infrastructure with fast NVMe storage and low-latency networking. Explore Hostingowy's VPS and dedicated server plans โ all running in European data centres (Poland) with your choice of PostgreSQL or MySQL pre-installed.