I am having some difficulties with ORM to delete data and I would like to know if that is a better way to optimize the operation.
The problem I am experiencing is a very low performance when deleting items with ORM’s delete cascade in scenarios with large data amount.
In my case, it’s a delete cascade with a depth of 4 levels and in some of these levels there are more than one property with persistent data.
I have already take a look to ORM log file and I have noticed that ORM its making delete operations in 14 tables for each item. This operation evidence perfomance lacks.
This was all working very well until the day that I have got about 1.050.000 items in the first level table, about 1.600.000 in the second, 9.000.000 in the third and 6.000 in the fourth.
For the delete operation, what I’m doing is a very simple oql query and then the command scope.remove(res.ToList());