PlanetScale has launched support for foreign key constraints after facing several technical challenges. It took around a year to overcome these challenges and ensure compatibility with branching, Online DDL, gated deployments, online imports, and cross shard support. The challenges included handling branching and deploy requests, handling reverts, and addressing issues with query serving and online DDL. The implementation of foreign key constraints in Vitess is owned by Vitess itself and involves additional locking and communication with the MySQL server. While foreign key constraints are supported in unsharded environments, there are limitations such as no support for cyclic foreign key references and the possibility of orphaned rows with schema reverts.
Table of contents
Branching and Deploy requestsQuery servingOnline DDLQuery serving, revisitedDatabase importsTesting foreign key constraint supportForeign key constraints support limitationsSummarySort: