Decision in brief
Keep MySQL when your application and team already depend on MySQL behavior and both performance and recovery meet your targets. Shortlist PostgreSQL for a greenfield system that benefits from its SQL features or extensions, or when a measured workload exposes a limit you cannot remove on MySQL. Switch an existing system only after proving application parity, tail latency, recovery, and rollback.

PostgreSQL vs MySQL in common production scenarios
The comparison here is PostgreSQL versus MySQL with InnoDB. A framework, provider, or operator can override session defaults. Record the actual engine version and settings before treating differences below as application behavior.
| Your situation | Practical starting point | What would change the decision |
|---|---|---|
| A working MySQL application with a MySQL-specific vendor integration | Keep MySQL and profile the slow or unreliable paths first. | A required capability, structural cost, or repeated failure that remains after tuning. Calculate the cost of replacing integrations and training on-call staff. |
| A greenfield service with a specific PostgreSQL feature or extension in the design | Prototype on PostgreSQL with the same extension versions available in production. | Your provider does not support the extension, backup restores cannot reproduce it, or the team already has stronger MySQL operations for this workload. |
| An ingest-heavy system facing a consolidation decision | Test tuned versions of both under the same durability, storage and replication settings. | Decide on measured write backlog, read freshness, p99 time and failover results. Retaining both can be better than forced consolidation. |
| A portability requirement | Define the SQL and driver features both engines must implement and run one behavioral test suite against each. | A mature abstraction can absorb many differences. Retry semantics, collation and vendor-specific SQL still need integration tests. |
SQL differences to test before a move
PostgreSQL provides INSERT … ON CONFLICT with a conflict target for DO UPDATE. MySQL uses INSERT … ON DUPLICATE KEY UPDATE when a primary-key or unique-key conflict occurs. Include an input that conflicts with two unique indexes in the test fixture and define which row the application expects to update. PostgreSQL identity columns use GENERATED … AS IDENTITY, while MySQL schemas commonly use AUTO_INCREMENT. Import explicit IDs and check the next generated value after restoring data.
InnoDB defaults to REPEATABLE READ. PostgreSQL defaults to READ COMMITTED. Two reads in one transaction can therefore observe a different history after a database migration. Check the real session isolation level and run concurrency tests for the transaction types your application relies on. Treat driver and engine errors as part of the contract, including retries after deadlock or serialization failures.
MySQL vs Postgres performance on the same workload
A single throughput number averages away queue growth, pool waits and tail latency. Replay your read and write mix with representative cardinality, skew and hot tenants. Compare an equivalently indexed baseline first, then document resource and engine-specific tuning separately.
- Define the service budget in advance. Include acceptable p95 and p99 latency, maximum lag for consumers, resource limits, and the amount of downtime and data loss the business accepts.
- Load a sanitized fixture into isolated databases. Match durability, client concurrency, connection-pool size and hardware constraints. Use a warmed run and a cold-start run.
- Capture slow statements, query plans, CPU, memory, disk activity and transaction retry counts. Repeat the busiest writer burst while normal readers remain active. Include a failed run and check whether recovery preserves acknowledged writes.
- Reattempt the replay with evidence-based changes. Keep a record of which index, setting or query improved each metric. Drop the migration if the incumbent now meets the targets and the operational cost remains lower.
What the Hacker News cases add
In the discussion on scaling PostgreSQL, daneel_w reported that lowering index fillfactor, using BRIN for suitable columns and allowing more memory substantially improved an ingestion trial. The team was considering consolidation in both directions and might keep both engines. The case supports retesting the bottleneck before making an engine decision. It does not establish a generally superior fillfactor, index type or engine.
On the AliSQL discussion, ozgune argued that evaluating a PostgreSQL analytical integration through a MySQL-style storage-engine lens would miss alternatives such as foreign data wrappers. That is an architecture argument, rather than a measured performance result. When comparing features, prototype an idiomatic solution in each system before tallying the checkboxes.
Migration and rollback checklist
A reversible endpoint switch is straightforward only while the old system still has all accepted changes. Before writing to the new primary, choose a verified reverse path, a reconciliation process, or a cutover that stays read-only until you commit to the move.
- Inventory SQL, triggers, stored routines, scheduled jobs, collation, timestamp conversion, nullability and unique constraints. Run automated diffs on business invariants, not only row counts.
- Rehearse a snapshot load and ordered change capture or a bounded write freeze. Compare source and target by key range, record a synchronization watermark, and repeat the cutover on staging.
- Switch a bounded cohort if the architecture supports it. Monitor error, lag and latency budgets. If a gate fails, stop the cutover and reconcile writes since the watermark before returning traffic to the old primary.
- Record the results of restoration and rollback in the decision document. A benchmark win does not excuse a recovery gap.