Is PostgreSQL Really the Most Popular Database? A Deep Dive into Rankings, Architecture, and Performance
This article examines why PostgreSQL appears to outrank MySQL in recent popularity surveys, explains the DB‑Engines ranking methodology, compares architectural choices such as MVCC, multi‑process vs multi‑thread models, transaction rollback behavior, licensing, and real‑world performance benchmarks like TPC‑C, ultimately revealing that MySQL still dominates many high‑throughput OLTP scenarios.
Popularity Survey and Initial Claims
According to the 2023 StackOverflow Developer Survey, PostgreSQL surpassed MySQL to become the most popular database among professional developers (50% vs 54% for beginners). Some readers immediately proclaimed PostgreSQL as the world’s most loved database, sparking heated debate.
Defining "Success" and DB‑Engines Ranking
Success can be measured by popularity, technical features, application domains, and user preference. The DB‑Engines ranking, which focuses exclusively on databases, is considered a more authoritative metric because it aggregates multiple indicators:
Number of mentions on search engines (Google, Bing)
Search interest from Google Trends
Technical discussion volume on Stack Overflow and DBA Stack Exchange
Job postings on Indeed and Simply Hired
Number of LinkedIn profiles mentioning the system
Twitter tweet count
Each indicator is normalized and averaged, producing a relative popularity score that can be compared across systems. The score does not reflect actual installation numbers but serves as an early indicator of market interest.
Why the DB‑Engines Result May Mislead
The DB‑Engines methodology includes many data sources, but the StackOverflow survey only sampled fewer than 80,000 respondents, which is a small fraction of the global developer community. Relying solely on that survey can give a biased view of true popularity.
Current DB‑Engines Top‑4 and Market Trends
The latest DB‑Engines list shows the top four databases are all relational: Oracle (rank 1, proprietary), MySQL (rank 2), SQL Server (rank 3), and PostgreSQL (rank 4). Oracle’s market share in China is expected to shrink due to the rise of domestic alternatives.
Distributed vs. Centralized Databases
Some argue that distributed databases sacrifice features, performance, and reliability for scale, but modern NVMe SSD hardware dramatically improves cost‑performance, making single‑node databases capable of handling millions of QPS. Real‑world cases such as WeChat’s 5‑year‑old order data (petabyte scale) demonstrate that a distributed solution like TDSQL is often necessary.
TDSQL offers 100% MySQL‑compatible compute nodes, offloading sharding and routing to the storage layer, thus simplifying application development and operations.
Benchmarking with TPC‑C
TPC‑C remains a rigorous benchmark for OLTP performance. OceanBase achieved 7.07 billion tpmC in 2020, and Tencent Cloud’s recent run in early 2023 claimed the world‑first double‑lead in both throughput and price‑per‑tpmC.
Transaction Rollback Behavior
BEGIN;
INSERT INTO t VALUES (1,...);
INSERT INTO t VALUES (1,...); -- primary‑key conflict, error
COMMIT;
SELECT * FROM t; -- returns the first rowIn MySQL, the transaction commits despite the second insert failing, leaving the first row persisted. PostgreSQL (and Oracle, SQL Server) can be configured to abort the whole transaction on a single statement error, but this is a feature controlled by the sql_mode or equivalent settings rather than a bug.
Open‑Source Licenses
PostgreSQL uses the permissive PostgreSQL License (similar to MIT), allowing commercial use and redistribution without source‑code disclosure. MySQL is licensed under GPLv2, which requires derivative works to be released under the same license, encouraging community contributions but limiting proprietary integration.
MVCC Implementation
PostgreSQL stores both historic and current tuple versions in the heap table, eliminating the need for explicit rollback. A background VACUUM process cleans up dead tuples; VACUUM FULL also rewrites pages to remove fragmentation.
MySQL and Oracle use undo segments: when a row is updated, the old version is written to an undo log, allowing the system to reconstruct prior states if needed. Once no active transaction can see the old version, the undo entry can be reclaimed.
Process vs. Thread Model
PostgreSQL (multi‑process)
Stability: a crash in one process does not affect others.
Memory isolation reduces cross‑process impact of leaks.
Simpler development model.
Higher resource overhead and more expensive context switches.
Inter‑process communication is more complex.
MySQL (multi‑thread)
Shared memory leads to lower memory usage and faster context switches.
Higher concurrency on multi‑core CPUs.
Simpler thread‑to‑thread communication.
Potential stability issues: a fault in one thread can affect the whole process.
Complex synchronization and lock management.
The design choices stem from historical OS support: PostgreSQL was created when thread support was weak, while MySQL’s founder Monty chose the more challenging multi‑thread path once OS threading matured.
Storage Engine Differences
PostgreSQL uses heap tables with CTID pointers; indexes point to heap rows. MySQL’s InnoDB uses a clustered index (primary key) where data is stored in the leaf nodes, offering faster primary‑key lookups and better space efficiency but incurring extra overhead for inserts and updates that must maintain order.
Overall Comparison
PostgreSQL excels in complex query optimization and feature richness, whereas MySQL shines in high‑throughput OLTP workloads. Real‑world large‑scale systems (e.g., Tencent’s TXSQL, Alibaba’s OceanBase) often choose MySQL‑compatible engines for their proven consistency, performance, and operational simplicity.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
ITPUB
Official ITPUB account sharing technical insights, community news, and exciting events.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
