Databases 9 min read

Why Do Some Projects Still Choose MySQL Over PostgreSQL?

The article compares PostgreSQL and MySQL, detailing PostgreSQL’s richer data types, true sequence support, extensible ecosystem, advanced monitoring and replication features, while also acknowledging MySQL’s simplicity and strong points, to help readers decide which database fits their workload best.

java1234
java1234
java1234
Why Do Some Projects Still Choose MySQL Over PostgreSQL?

In recent years, the push for domestic, open‑source databases has made PostgreSQL a popular foundation for Chinese cloud and HTAP products. Major providers such as Tencent Cloud TBase (https://github.com/Tencent/TBase), Alibaba Cloud PolarDB for PostgreSQL, Huawei Cloud GaussDB (openGauss) (https://opengauss.org) and Hangzhou YiJing openHalo (https://github.com/HaloTech-Co-Ltd/openHalo) all build on PostgreSQL because of its open‑source nature, stability and feature set.

Why choose PostgreSQL when MySQL is also open source?

1. Richer data types – PostgreSQL supports native ARRAY columns, range types like int4range and tsrange, user‑defined composite types (e.g., POINT(x,y)) and JSONB which can be indexed, queried and updated efficiently. MySQL’s core types are more basic and lack these capabilities.

2. True sequence objects – PostgreSQL provides independent SEQUENCE objects that can be used without a table. Example:

CREATE SEQUENCE order_seq START WITH 1 INCREMENT BY 1;

and then:

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

MySQL 5.7+ only simulates sequences with AUTO_INCREMENT + 3088413 or user variables, which cannot be shared across tables and are hard to guarantee uniqueness in distributed environments.

3. Extensible ecosystem – PostgreSQL’s extension mechanism allows adding functionality such as TimescaleDB (time‑series), pg_trgm (fuzzy matching), Citus (distributed), and pg_stat_statements (SQL statistics). The author describes PostgreSQL as a “programmable database” that can be turned into an application platform.

4. Monitoring and diagnostics – PostgreSQL ships with built‑in views like pg_stat_activity, pg_stat_statements, pg_locks and supports EXPLAIN ANALYZE for real execution time. Third‑party tools such as PgAdmin, pg_stat_monitor and Prometheus + Grafana provide mature visualisation. MySQL relies on Performance Schema and slow_query_log, which are harder to configure and lack integrated visual tools.

5. Replication capabilities – MySQL defaults to asynchronous replication, has optional semi‑sync, and GTID can be fragile. PostgreSQL offers streaming replication (async or sync), logical replication for per‑table or cross‑version copy, and a mature WAL mechanism that ensures data durability and zero data loss when synchronous replication is enabled.

6. Licensing and community – MySQL’s GPL + commercial license is controlled by Oracle, with enterprise‑only features and a development process influenced by a single vendor. PostgreSQL uses a BSD‑like license, is fully community‑driven, and its entire feature set is available in the open‑source edition.

7. MVCC implementation – PostgreSQL stores multiple row versions in the heap, providing true snapshot isolation and allowing readers to see a previous state while writers are updating. MySQL keeps only the current version and uses an undo log; reads are faster but long‑running transactions can cause undo‑log bloat and “dirty read” or “non‑repeatable read” depending on isolation level.

Overall, the choice is workload‑dependent: systems that need long‑term evolution, complex data models and strong consistency benefit from PostgreSQL, while fast‑to‑deploy, read‑heavy web applications may still prefer MySQL. The rise of domestic databases demonstrates that many Chinese companies are building on PostgreSQL’s open, user‑driven foundation to achieve independent innovation.

MySQLreplicationopen-sourcePostgreSQLDatabase comparisonMVCCExtensions
java1234
Written by

java1234

Former senior programmer at a Fortune Global 500 company, dedicated to sharing Java expertise. Visit Feng's site: Java Knowledge Sharing, www.java1234.com

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.