Databases 9 min read

Why Choose MySQL When PostgreSQL Offers So Many Advantages?

The article analyzes why many leading Chinese tech firms adopt PostgreSQL despite MySQL’s popularity, detailing PostgreSQL’s richer data types, native sequence support, extensible ecosystem, advanced monitoring tools, robust replication, open‑source licensing, and MVCC implementation, while also acknowledging MySQL’s strengths in simple deployment and read‑heavy workloads.

SpringMeng
SpringMeng
SpringMeng
Why Choose MySQL When PostgreSQL Offers So Many Advantages?

Domestic databases built on PostgreSQL

Tencent Cloud TDSQL PG (open‑source code name: TBase) – https://github.com/Tencent/TBase. Uses GTM global transaction manager and distributed coordination for cross‑shard transactions.

Alibaba Cloud PolarDB for PostgreSQL – redesigns the storage layer to provide “one‑write multi‑read shared storage” and second‑level scaling of read nodes.

Huawei Cloud GaussDB (openGauss) – https://opengauss.org. Adds a column‑store engine and AI optimizer to support HTAP.

Hangzhou Yijing Shutong openHalo – https://github.com/HaloTech-Co-Ltd/openHalo.

Technical advantages of PostgreSQL over MySQL

Richer data types

PostgreSQL provides native array, range (e.g., int4range, tsrange), composite (e.g., POINT(x,y)) and JSONB types, which support indexing, querying and updating.

Independent sequence objects

PostgreSQL can create a true sequence:

CREATE SEQUENCE order_seq START WITH 1 INCREMENT BY 1;

and use it directly:

INSERT INTO orders (id, name) VALUES (nextval('order_seq'), 'test');

MySQL 5.7+ simulates a sequence with AUTO_INCREMENT + 3088413, binds it to a specific table, cannot be shared across tables, and in distributed environments requires external middleware to guarantee uniqueness.

Extensible ecosystem

Popular PostgreSQL extensions include: TimescaleDB – time‑series database with automatic partitioning and compression. pg_trgm – fuzzy matching and similarity search. Citus – distributed database extension. pg_stat_statements – SQL execution statistics monitoring.

Built‑in monitoring and tooling

PostgreSQL ships with statistics views such as pg_stat_activity, pg_stat_statements, pg_locks and supports EXPLAIN ANALYZE for real execution time and row count. Mature third‑party tools (PgAdmin, pg_stat_monitor, Prometheus + Grafana) provide visual execution plans and lock‑wait information.

Replication and high‑availability

PostgreSQL offers:

Streaming Replication – supports both asynchronous and synchronous modes.

Logical Replication – allows table‑level or cross‑version replication.

Write‑Ahead Logging (WAL) – ensures data durability and consistency.

Synchronous Replication – primary waits for at least one replica acknowledgment before committing, achieving zero data loss.

MySQL defaults to asynchronous replication, which introduces latency risk and lacks strong consistency guarantees. GTID can mitigate some issues but misconfiguration may break replication; semi‑sync replication is not enabled by default and requires high‑quality network.

Licensing and community model

MySQL – GPL plus Oracle‑controlled commercial license; enterprise edition adds features such as audit and encryption.

PostgreSQL – BSD‑like license, fully free, community‑driven development with transparent source code.

MVCC implementation

PostgreSQL stores multiple versions per row in the heap, preserving old versions until vacuum cleans them, providing full isolation and serializable snapshot isolation. MySQL keeps only the current version in the heap, with older versions in the undo log, which can lead to undo‑log bloat for long transactions.

Consequences:

In PostgreSQL, readers can see a previous state even while a writer updates.

In MySQL, uncommitted changes may appear as dirty reads or non‑repeatable reads depending on the isolation level.

Comparative summary

PostgreSQL provides independent sequences, richer data types, extensive extensions, built‑in monitoring, flexible replication, permissive licensing, and a robust MVCC model.

MySQL offers simpler deployment, strong read performance, a mature web ecosystem, and deep cloud‑provider optimizations, but its feature set lags in the areas above.

MySQLreplicationopen-sourcePostgreSQLDatabase comparisonMVCCExtensions
SpringMeng
Written by

SpringMeng

Focused on software development, sharing source code and tutorials for various systems.

0 followers
Reader feedback

How this landed with the community

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.