I've got a performance issue doing deletes. I have a simple model where a grandparent, parent, child, grandchild relationship exists, with one grandparent having 2 or 3 thousand grandchildren. I delete the parent and cascade it down the relationships to delete the whole lot.

This takes 5 mins on a 1.6GHz Core2 machine.

I'm just doing this:

entityManager.remove(grandparent);

Is there a better way or do I just have to put some indices on the database? I thought standard foreign key constraints acted as indices in databases - isn't that so?

Thanks
Adam

Reply via email to