I have an InnoDB claims table that contains about 240 million rows. The table has a foreign key constraint: CONSTRAINT FK78744BD7307102A9 FOREIGN KEY (ID) REFERENCES claim_details (ID) . I want to delete the claim_details table as quickly as possible.
Based on some experiments, it seems that if I use SET foreign_key_checks = 0; drop claim_details and then re-activate the foreign keys, mysql will continue to enforce the constraint even if the table no longer exists. So, I believe that I should remove the restriction from the table.
I tried using ALTER TABLE claims DROP FOREIGN KEY FK78744BD7307102A9 to remove the restriction, and the request was in the "copy to tmp table" state for more than 24 hours (on a machine without any other load). I do not understand why a reset of the table requires a copy of the table. Is there any way to prevent this?
mysql version 5.1.48.
source share