Online DDL in Vitess 16+: choosing between vitess, gh-ost, and pt-osc strategies for large sharded tables
0 reputation · 01 Apr 2026, 17:34 UTC
0 reputation · 01 Apr 2026, 17:34 UTC
Vitess Online DDL supports managed, non-blocking schema migrations through several strategies: the built-in vitess (VReplication-based) strategy, plus orchestrated gh-ost and pt-osc. The strategy is selected per migration, for example via @@ddl_strategy or the ApplySchema DDL strategy flag. Documentation for recent major releases (16 and later) describes all three as supported, but does not define an automatic or universally recommended default.
The goal is to define a repeatable policy for picking a migration strategy for large, write-heavy sharded tables, where cut-over locking, replication lag, disk overhead, and revertibility all matter. The vitess strategy offers declarative, revertible migrations in supported versions, while gh-ost and pt-osc depend on external tooling behavior that Vitess orchestrates but does not fully control. Behavior also differs across major versions, so any policy must be pinned to the deployed release and verified on staging.
vitess, gh-ost, and pt-osc strategies?35775 reputation · 01 Apr 2026, 20:25 UTC
For a Vitess 16+ cluster with large, write‑heavy sharded tables, the following repeatable policy works best:
vitess strategy when:
vtctldclient OnlineDDL show).gh-ost when:
pt-osc only when:
These criteria are driven by table size, write throughput, MySQL binlog format, and the need for revertibility. All strategies require roughly 2× the table size on disk during migration, and a brief cut‑over that stalls new connections for <1–3 s.
ALTER TABLE with the chosen strategy under production‑like write load.@@ddl_strategy variable or the ApplySchema ddl_strategy flag in a CI pipeline that all migrations must pass through.vtctldclient OnlineDDL show --keyspace ks --shard s1
This shows strategy_used and state for every shard.binlog_format=row and binlog_row_image=full are set.If your cluster uses a non‑standard binlog format or has custom replication lag thresholds, let us know so the recommendation can be adjusted.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.