I have a Product
model that has_many
ProductAttributes
in a Rails 4.2.3 application.
A Product
can have over 10,000 ProducAttributes sometimes.
I need to delete some of these products, but when I call destroy
on the product, it takes a really, really long time. It looks like it gets a list of ids from ProductAttribute
, then called delete on each one individually.
But then when it gets to the end, it just sort of hangs. I have a lot of data to delete, and occasionally I will need to do this.
But I can't just have this thing hang forever. Eventually I have to do a Ctrl-C
, after which time I see Rollback
happening.
My question is, what in the heck is it doing? Why can't I reliably delete lots of data from the application layer?