Why Leading Tech Giants Prefer PostgreSQL Over MySQL: A Deep Technical Comparison
The article examines why major Chinese cloud providers and enterprises are building PostgreSQL‑based distributed, cloud‑native databases instead of MySQL, detailing PostgreSQL's richer data types, native sequence support, extensible ecosystem, advanced replication, licensing advantages, and MVCC implementation, while also noting MySQL's remaining strengths.
Background
With the push for domestic innovation and the need for autonomous, controllable databases, PostgreSQL has become the preferred open‑source foundation for many Chinese technology leaders. Companies such as Tencent, Alibaba, Huawei, and Hangzhou 易景数通 have built customized, distributed, cloud‑native, or HTAP database systems on top of PostgreSQL.
Open‑Source PostgreSQL‑Based Products
Tencent Cloud TDSQL PG (code‑named TBase) – https://github.com/Tencent/TBase Alibaba Cloud PolarDB for PostgreSQL – custom storage layer with “one‑write‑many‑read” shared storage and rapid read‑replica scaling
Huawei Cloud GaussDB (openGauss) – partially compatible with the PostgreSQL ecosystem, adds columnar storage and AI‑optimized query engine for HTAP workloads – https://opengauss.org Hangzhou 易景数通 openHalo – open‑source distribution –
https://github.com/HaloTech-Co-Ltd/openHaloWhy Choose PostgreSQL Over MySQL?
1. Richer Data Types
PostgreSQL supports advanced types that MySQL lacks:
Array : store multiple values in a single column.
Range : e.g., int4range, tsrange for time or price intervals.
Composite : custom structures such as POINT(x,y).
JSONB : binary JSON with indexing, fast queries, and updates.
2. Native Sequence Objects
PostgreSQL provides true independent sequences (e.g., CREATE SEQUENCE order_seq START WITH 1 INCREMENT BY 1;) that can be used across tables. MySQL emulates sequences with AUTO_INCREMENT + offset, which cannot be shared across tables and complicates distributed uniqueness.
-- PostgreSQL example
CREATE SEQUENCE order_seq START WITH 1 INCREMENT BY 1;
INSERT INTO orders (id, name) VALUES (nextval('order_seq'), 'test');MySQL equivalent requires table‑bound AUTO_INCREMENT or manual variable tricks, and lacks cross‑table sharing.
3. Extensible Ecosystem
PostgreSQL’s extension mechanism allows powerful add‑ons such as: TimescaleDB – time‑series database with automatic partitioning and compression. pg_trgm – fuzzy matching and similarity search. Citus – distributed database scaling. pg_stat_statements – detailed SQL execution statistics.
These turn PostgreSQL into a programmable platform, whereas MySQL’s ecosystem offers fewer comparable extensions.
4. Monitoring and Diagnostics
PostgreSQL includes built‑in views such as pg_stat_activity, pg_stat_statements, and pg_locks, supports EXPLAIN ANALYZE, and integrates smoothly with tools like PgAdmin, pg_stat_monitor, Prometheus, and Grafana. MySQL relies on Performance Schema, slow_query_log, and manual SHOW PROCESSLIST or EXPLAIN, which are harder to interpret and lack visual tools.
5. Replication Capabilities
PostgreSQL offers mature replication options:
Streaming Replication – asynchronous or synchronous modes.
Logical Replication – table‑level or cross‑version replication.
WAL (Write‑Ahead Logging) – ensures durability and consistency.
Synchronous Replication – guarantees zero data loss by waiting for at least one standby.
MySQL’s primary/replica model is more of a backup mechanism, with default asynchronous replication, optional GTID, and semi‑sync requiring extra configuration.
6. Licensing and Community
MySQL is released under GPL with a commercial Oracle‑controlled license, leading to potential feature delays and limited community influence. PostgreSQL uses a BSD‑like license, is governed by the PostgreSQL Global Development Group, and enjoys a transparent, vendor‑independent community.
7. MVCC Implementation
PostgreSQL stores multiple row versions directly in the heap, enabling true snapshot isolation and allowing readers to see a consistent view while writers are updating. MySQL’s InnoDB keeps only the current version in the table and older versions in the undo log, which can cause rollback segment bloat for long transactions.
8. Practical Trade‑offs
While PostgreSQL offers superior functionality for complex data models, strong consistency, and extensibility, MySQL remains attractive for rapid deployment, high read‑throughput web workloads, and a mature web ecosystem (WordPress, Laravel, Django, etc.). Cloud providers also provide deep, automated tuning for MySQL.
Conclusion
PostgreSQL and MySQL are not universally better or worse; the choice depends on system requirements. For long‑term evolution, complex schemas, and strict consistency, PostgreSQL provides a more robust foundation. For quick launches and read‑heavy web applications, MySQL remains efficient. The rise of domestic databases builds on PostgreSQL’s open‑source strengths to achieve independent innovation.
Architect's Tech Stack
Java backend, microservices, distributed systems, containerized programming, and more.
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.
