---
title: "Partitioning GitHub’s relational databases to handle scale"
description: "GitHub split its monolithic `mysql1` MySQL cluster by first virtually partitioning tables into schema domains (declared in YAML) and enforcing boundaries with query and transaction linters, then physically moving domains to new clusters via Vitess vertical sharding or a custom ProxySQL/GTID-based write-cutover script."
url: "https://swe.quest/articles/partitioning-github-s-relational-databases-to-handle-scale-7b5ea75acfc088c0"
canonical: "https://github.blog/engineering/infrastructure/partitioning-githubs-relational-databases-scale/"
source: "GitHub Engineering"
published: "2021-09-27"
difficulty: "medium"
kind: "Case study"
reading_minutes: 9
tags: ["mysql","distributed-databases","scalability","schema-migrations","ruby"]
---

# Partitioning GitHub’s relational databases to handle scale

A post on [GitHub Engineering](https://swe.quest/sources/github.md), published 2021-09-27, 9 min read, Case study. Original: [https://github.blog/engineering/infrastructure/partitioning-githubs-relational-databases-scale/](https://github.blog/engineering/infrastructure/partitioning-githubs-relational-databases-scale/)

## Summary

GitHub split its monolithic \`mysql1\` MySQL cluster by first virtually partitioning tables into schema domains (declared in YAML) and enforcing boundaries with query and transaction linters, then physically moving domains to new clusters via Vitess vertical sharding or a custom ProxySQL/GTID-based write-cutover script. Cross-domain joins were eliminated with techniques like preload, Rails' new \`disable\_joins\` option and application-side joins, validated with Scientist experiments. The write-cutover moved 130 of the busiest tables in tens of milliseconds with only a handful of failed writes. Query volume grew from 950k to 1.2M queries/s while average per-host load halved, reducing database-related incidents.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [MySQL](https://swe.quest/tags/mysql.md) (Data & databases)
- [Distributed databases](https://swe.quest/tags/distributed-databases.md) (Data & databases)
- [Scaling](https://swe.quest/tags/scalability.md) (Distributed systems)
- [Schema migrations](https://swe.quest/tags/schema-migrations.md) (Data & databases)
- [Ruby](https://swe.quest/tags/ruby.md) (Languages)

## Prerequisites

- MySQL replication ([easy posts on MySQL](https://swe.quest/tags/mysql.md?difficulty=easy))
- Rails ActiveRecord ([easy posts on Ruby](https://swe.quest/tags/ruby.md?difficulty=easy))
- database transactions ([easy posts on Databases](https://swe.quest/tags/databases.md?difficulty=easy))

## Keywords

GitHub, MySQL, Vitess, ProxySQL, Ruby on Rails, ActiveRecord, Scientist, GTID

## Related posts

- [Horizontally scaling the Rails backend of Shop app with Vitess](https://swe.quest/articles/horizontally-scaling-the-rails-backend-of-shop-app-with-vitess-03c7b2da20f98ec3.md): Shopify Engineering · 2024-01-17 · Medium · 27 min read · MySQL, Distributed databases, Ruby, Scaling, Schema migrations
  Shop app outgrew a single MySQL database despite federating tables across databases, so the team moved its Rails backend to Vitess, sharding user-owned tables by user\_id into a "users" keyspace and keeping the rest in an unsharded "global" keyspace.
- [Breaking up a monolith: How we’re unwinding a shared database at scale](https://swe.quest/articles/breaking-up-a-monolith-how-we-re-unwinding-a-shared-database-at-scale-4f34dacf50e040a9.md): Datadog Engineering · 2025-06-17 · Medium · 20 min read · PostgreSQL, Schema migrations, Refactoring & migrations, Microservices, Replication
  Datadog is splitting its large shared Postgres database into independently owned instances through a three-phase plan: logical separation into per-domain private schemas with explicit ACLs, access reduction so only owning teams query their tables directly, and physical separation onto managed OrgStore instances.
- [Upgrading GitHub.com to MySQL 8.0](https://swe.quest/articles/upgrading-github-com-to-mysql-8-0-2c7892d15b6d7ff3.md): GitHub Engineering · 2023-12-07 · Medium · 11 min read · MySQL, Replication, Deployment, Databases
  GitHub upgraded 1200+ MySQL hosts (300+ TB, 5.5M QPS, 50+ clusters, including Vitess) from 5.7 to 8.0 over more than a year without breaking SLOs.
- [Migrating Etsy’s database sharding to Vitess](https://swe.quest/articles/migrating-etsy-s-database-sharding-to-vitess-c6bef1d09f2cd679.md): Etsy Code as Craft · 2026-03-19 · Medium · 9 min read · MySQL, Distributed databases, Refactoring & migrations, SQLite, Deployment
  Etsy moved shard routing for its ~1,000-table, ~1,000-shard, 425 TB MySQL cluster (1.7M requests/sec) from an ORM that looked up random shard mappings in a single index database to Vitess vindexes, without moving any data.
- [The growing pains of database architecture](https://swe.quest/articles/the-growing-pains-of-database-architecture-9202c659b7981acc.md): Figma · 2023-04-04 · Medium · 12 min read · PostgreSQL, Schema migrations, Scaling, Replication, Databases
  Facing ~3x annual database traffic growth and 65% peak CPU on a single Amazon RDS Postgres instance, Figma chose vertical partitioning (moving groups of tables to their own databases) over horizontal sharding, NewSQL, or self-hosting.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
