# Schema migration lock

> A migration ran ALTER TABLE on the biggest table. It held the lock while it copied it, and every write queued behind it until it timed out.

## What happens

A migration ran ALTER TABLE on the biggest table. It held the lock while it copied it, and every write queued behind it until it timed out.

## How to prevent it

Online schema migrations change a big table without holding the lock.

The postmortem opens the first of these that you do not own yet:

- [Online schema migrations](https://wiki.playquorum.dev/research/online-migrations.md)

## Components it hits

[Database](https://wiki.playquorum.dev/components/database.md)

## Facts

SEV2 Schema migration lock
- **First Era:** [Series A](https://wiki.playquorum.dev/eras/series-a.md)
- **Starts at:** SEV2
- **Escalates to:** SEVnull
- **Lasts:** 2.5 min

## See also

- [Incidents](https://wiki.playquorum.dev/incidents.md)

Source: https://wiki.playquorum.dev/incidents/migration-lock
