How OpenAI runs PostgreSQL for 800 million users without sharding
OpenAI serves ChatGPT from one PostgreSQL primary that handles all writes, supported by nearly 50 read replicas spread across regions. Rather than sharding its existing Postgres deployment, which would require changing hundreds of application endpoints, the company keeps load off the primary by routing reads to replicas and moving shardable, write-heavy workloads to systems like Azure Cosmos DB. It has also stopped adding new tables to this Postgres deployment and applies strict limits at every layer to prevent a single load spike from causing a wider outage. The article, drawing on OpenAI's January 2026 engineering post, describes how outages typically start with a sudden surge that triggers retries and cascading failures. Practical lessons include adding cache-miss locking, setting lock timeouts on migrations, and auditing write queries with pg_stat_statements.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in