Choosing an Online Schema Change: Native DDL or a Shadow Table
An online schema change modifies a table while a service continues to read and write. First check whether the DBMS’s native online DDL supports the exact operation and concurrency level you need. For a large change that requires copying rows while tracking ongoing writes, a separate migration tool such as gh-ost may fit. “Online” does not mean impact-free: verify operation-specific locks, replication lag, extra resources, and the final cut-over, then rehearse on a representative replica. [MySQL 8.4: InnoDB Online DDL](https://dev.mysql.com/doc/refman/8.4/en/innodb-online-ddl.html) [GitHub gh-ost](https://github.com/github/gh-ost)
Choosing an Online Schema Change: Native DDL or a Shadow Table
An online schema change modifies a table while a service continues to read and write. First check whether the DBMS’s native online DDL supports the exact operation and concurrency level you need. For a large change that requires copying rows while tracking ongoing writes, a separate migration tool such as gh-ost may fit. “Online” does not mean impact-free: verify operation-specific locks, replication lag, extra resources, and the final cut-over, then rehearse on a representative replica. MySQL 8.4: InnoDB Online DDL GitHub gh-ost
What does online DDL guarantee?
Native online DDL can run certain table changes with reads and writes continuing, but support depends on DBMS version, storage engine, and operation. For example, MySQL 8.4 InnoDB supports instant or in-place alterations with concurrent DML where permitted. ALTER TABLE options ALGORITHM and LOCK control aspects of execution. MySQL documents that LOCK=NONE requests reads and writes during an in-place operation, but the operation stops if that concurrency level is unavailable. Do not assume every ALTER is nonblocking just because an option exists. Check the operation-specific support and failure behavior for your version. MySQL 8.4 Online DDL
Native DDL may be appropriate for a supported, straightforward change. A path that does not copy the full table may use less extra space and I/O than a copy-based approach, but the operation still consumes resources and may require locks. Confirm that the exact syntax and environment support the requested LOCK=NONE or ALGORITHM=INSTANT behavior.
How does a shadow-table migration work?
A shadow-table tool creates a new table similar to the original, applies the new structure, and copies rows gradually. It also propagates ongoing inserts, updates, and deletes so the new table can catch up. When ready, it performs a final cut-over to replace the original table. This can separate a long copy from normal service traffic, but change propagation and the swap depend on the tool’s implementation and configuration.
GitHub’s gh-ost is a triggerless online schema-change tool for MySQL. Its project documentation describes incremental row copying to a ghost table, asynchronous propagation of changes read from the binary log, then replacing the original. It also documents a replica test mode that does not replace the source table, pausing/throttling, status checks, and postponing cut-over. These are gh-ost’s documented design and features, not a claim about every tool. gh-ost README
Which approach fits?
| Situation | First option to assess | Decision criteria |
|---|---|---|
| The DBMS supports this operation with instant/in-place online DDL | Native DDL | Permitted lock, copy behavior, expected load, failure behavior |
| A large table must be copied while ongoing changes continue to apply | Shadow-table tool | Binlog/replication compatibility, disk headroom, copy load, cut-over plan |
| Even a brief interruption is unacceptable or synchronization is complex | Rework the rollout | Staged application compatibility, alternate table/index strategy, maintenance window |
This table is a starting point, not a guarantee for any environment. MySQL ALGORITHM and LOCK support varies by specific alteration. gh-ost depends on MySQL, binary logs, and configuration; check its requirements against your replication topology.
Preflight and operating checks
**Confirm support.** Review the exact DBMS/version, storage engine, table definition, indexes, and foreign keys against operation-specific online-DDL support. For a tool, check privileges, replication format, binary-log retention, trigger handling, and foreign-key behavior.
**Plan resources.** A shadow-table approach may keep both tables while copying and applying changes, so allow for storage, I/O, and log headroom. Plan to observe replica lag and disk growth. These are operational implications of the copy pattern; no capacity or lag figure is claimed here.
**Rehearse and compare.** Confirm backups and recovery first, then run a representative replica rehearsal. gh-ost recommends a no-op validation before execution and testing on a replica. Compare row counts, key aggregates and samples, indexes, and constraints before and after. [gh-ost usage guidance](https://github.com/github/gh-ost)
**Set throttle and stop conditions.** Choose copy-speed limits, load/replica-lag thresholds, pause conditions, and a resume owner. Plan a separate observation point for cut-over. gh-ost documents postponing its table-swap step; other tools may not offer the same control. [gh-ost](https://github.com/github/gh-ost)
**Verify afterward.** Check application errors, database load and replication lag, schema definition, and data differences. Follow the tool’s supported recovery path if something is wrong. Decide how long to retain the old copy; removing it may eliminate a rollback option.
Choose based on the operation’s supported algorithm, load and locking, synchronization of concurrent changes, cut-over, and recovery—not on the word “online.” Native DDL can be simpler when it supports the change. A shadow-table tool can handle a longer copy with change tracking, but neither removes the need for rehearsal and explicit stop/recovery plans.