# Online Schema Migration

> Online schema migration in two layers: the engine layer (Postgres locks, MySQL Online DDL algorithms) decides what an ALTER costs; the deployment layer (gh-ost, pt-online-schema-change, blue-green deployment) handles what to do when the engine alone isn't enough.

Source: https://www.bytebase.com/online-schema-migration/

---

## Schema changes deployed live. Every engine.

Online schema migration is two problems, not one. The engine decides what locks an ALTER takes. Deployment decides what to do when those locks aren't acceptable.

## Two layers. One outcome.

### Engine layer

What the database does natively when you run ALTER. MySQL picks between INSTANT, INPLACE, and COPY. Postgres takes a lock mode. Each engine decides — quietly — whether your migration blocks writers, stalls replicas, or finishes in milliseconds.

### Deployment layer

What you reach for when the engine alone isn't enough. gh-ost and pt-online-schema-change shadow the table on a separate write path. Blue-green keeps two databases in sync and flips traffic. Both buy you migrations the engine can't do online — at the cost of running two systems instead of one.

## Read in order.

### Start with MySQL Online DDL

INSTANT, INPLACE, COPY — what each one rewrites, what each one locks, and when MySQL falls back. /blog/mysql-online-ddl

### Reach for gh-ost when COPY is too costly

On a billion-row table, MySQL's COPY fallback can take hours and stall replicas. gh-ost reads the binlog, builds a shadow table, and swaps it in. /blog/gh-ost-based-online-schema-migration-for-mysql

### Postgres works differently

Different lock model, different playbook. Sequence ALTERs correctly and most go online without help — there isn't a Postgres-side gh-ost if you need one. /blog/postgres-schema-migration-without-downtime

## Get Started

- [Contact us](https://www.bytebase.com/contact-us/)
- [Start now (cloud)](https://console.bytebase.com)
