Why Uber Engineering Switched from Postgres to MySQL

Evan Klitzke
25 min readadvanced
--
View Original

Overview

The article discusses Uber Engineering's transition from PostgreSQL to MySQL, detailing the limitations encountered with PostgreSQL and the advantages of MySQL's architecture, particularly in terms of performance, replication, and data handling. It highlights specific architectural differences that led to this decision, including write amplification and data corruption issues.

What You'll Learn

1

How to identify the limitations of PostgreSQL in high-scale environments

2

Why MySQL's architecture is advantageous for large-scale applications

3

When to consider migrating from PostgreSQL to MySQL

Prerequisites & Requirements

  • Understanding of database architectures and their implications on performance

Key Questions Answered

What limitations did Uber face with PostgreSQL?
Uber encountered several limitations with PostgreSQL, including inefficient architecture for writes, data replication issues, table corruption, poor MVCC support for replicas, and difficulties upgrading to newer releases. These issues became significant as Uber scaled, prompting the need for a more robust solution.
How does MySQL's architecture differ from PostgreSQL's?
MySQL's architecture, particularly with the InnoDB storage engine, uses a secondary structure for indexes that points to primary key values rather than directly to on-disk row locations. This design allows for more efficient updates and replication, reducing the overhead associated with index maintenance compared to PostgreSQL.
What are the consequences of PostgreSQL's design on replication?
PostgreSQL's design leads to a verbose replication stream, as it replicates physical changes rather than logical updates. This results in higher bandwidth usage and potential performance issues, especially in multi-data center environments, compared to MySQL's more efficient logical replication.

Technologies & Tools

Some links below are affiliate links. We may earn a commission if you make a purchase.

Key Actionable Insights

1
Evaluate the scalability of your database architecture as your application grows.
As seen with Uber's transition, understanding the limitations of your current database system is crucial for long-term success. Regular assessments can help prevent performance bottlenecks.
2
Consider the implications of write amplification when designing your database schema.
Write amplification can significantly affect performance and storage costs. Choosing a database system that minimizes these effects can lead to better resource management.
3
Implement robust monitoring for data integrity and replication health.
Monitoring can help identify issues such as data corruption early, allowing for timely interventions before they escalate into larger problems.

Common Pitfalls

1
Failing to recognize the impact of database architecture on application performance.
Many developers may overlook how their choice of database can affect scalability and efficiency, leading to issues as their applications grow.