The Gordian Knot of Online Schema Changes and Foreign Keys in MySQL

2025-02-12
The Gordian Knot of Online Schema Changes and Foreign Keys in MySQL

This post dissects the inherent challenges of performing online schema changes in MySQL, particularly when dealing with tables linked by foreign key relationships. The author analyzes the limitations of existing tools like pt-online-schema-change and gh-ost, highlighting the complexities and risks involved in altering parent tables. Altering a parent table necessitates concurrent alterations of all child tables, creating a fragile process with minimal tolerance for errors. A single failure can lead to data inconsistencies or outages. The author concludes that online schema changes involving foreign key constraints on large tables are practically infeasible.

Development Online Schema Change