Databases 7 min read

MySQL vs PostgreSQL Performance Benchmark: Latency, Throughput, and Saturation

The benchmark comparing MySQL 9.0 and PostgreSQL 17.0 shows PostgreSQL consistently achieving lower insertion latency, roughly double the throughput (≈19 k QPS vs 10 k QPS), using less CPU, memory and disk I/O, while both hit an 80‑connection pool limit and PostgreSQL maintains stable read latency as MySQL’s performance degrades beyond ~5.5 k QPS.

Java Tech Enthusiast
Java Tech Enthusiast
Java Tech Enthusiast
MySQL vs PostgreSQL Performance Benchmark: Latency, Throughput, and Saturation

This article translates and condenses Anton Putra’s benchmark that compares MySQL 9.0 and PostgreSQL 17.0 on data ingestion, retrieval, and saturation. The test suite measures insertion latency (p99), throughput (requests per second), CPU and memory usage, disk I/O, and connection‑pool behavior.

Two tables – Customer (id, name, address) and Event (id, customer_id, action_type) – are created in each database. The first test inserts randomly generated records, gradually increasing load by adding a virtual client every 60 seconds until the system saturates. The second test runs a simple JOIN query on ~70 million rows to evaluate read performance.

Key findings:

PostgreSQL consistently shows lower insertion latency and higher throughput; it handles up to ~19 k QPS, while MySQL caps around 10 k QPS.

PostgreSQL uses less CPU and memory and performs fewer disk operations, indicating higher storage efficiency.

Both databases reach a connection‑pool limit of 80 connections (40 per client).

During read tests, PostgreSQL maintains lower latency and more stable CPU usage, whereas MySQL’s latency spikes as QPS exceeds ~5.5 k, eventually hitting a CPU bottleneck.

Conclusion: PostgreSQL outperforms MySQL in both write‑heavy and read‑heavy workloads under the tested conditions. The author invites suggestions for improving the test design or client implementation.

DatabasePerformance BenchmarklatencyMySQLPostgreSQLSaturationthroughput
Java Tech Enthusiast
Written by

Java Tech Enthusiast

Sharing computer programming language knowledge, focusing on Java fundamentals, data structures, related tools, Spring Cloud, IntelliJ IDEA... Book giveaways, red‑packet rewards and other perks await!

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.