News for hackers. Stuff that matters.
Re:The problem with MySQL foreign key constraints in Online ... by javier2 on Wednesday February 12, 2025 @11:06AM (#43026713)
wouldnt that take an awful long time when validating the foreign keys again? You cant flip the tables again until all foreign keys are valid.

I am asking out of curiosity, as I have used pt online schema change extensively before, but am right now working mostly with postgres

Re:The problem with MySQL foreign key constraints in Online ... by cwillu on Wednesday February 12, 2025 @10:53PM (#43032499)
“After that, a VALIDATE CONSTRAINT command can be issued to verify that existing rows satisfy the constraint. The validation step does not need to lock out concurrent updates, since it knows that other transactions will be enforcing the constraint for rows that they insert or update; only pre-existing rows need to be checked. Hence, validation acquires only a SHARE UPDATE EXCLUSIVE lock on the table being altered. (If the constraint is a foreign key then a ROW SHARE lock is also required on the table referenced by the constraint.) ”

--https://www.postgresql.org/docs/current/sql-altertable.html