Please, help to optimize object destroing in Rails application: I have relatively big database, and when I want to delete user from it all dependent objects removing takes > 1 minute. It's very long. Database has indexes for field, used to find data, without indexes it takes > 5 minutes.
I see that every one query takes a little time: 0.1 - 1ms. but there many queries. Question is: how can I tell rails to remove ALL related objects using one database transaction? I think this should speed up this operation and some other operations too.
Thanks