by efxhoy · 5y ago · 0 comments
The table I was deleting from had 20 foreign key constraints referencing it, and a couple of them didn't have an index on the referencing column and were big (a few million rows). Added indexes to all of them, took a couple of minutes to build, and the DELETE ran in a few seconds.
Sometimes the answer to a performance issue can't be found in EXPLAIN. And always remember to properly index your foreign key constraints.