I have an object that I need to delete the records nightly and then re-import. I am using a data maintenance batdch job to run the delete record trigger. My issue is it is taking a really long time to run through the records. I had a couple days in a row where the delete failed due to a timeout setting in shared properties. Now I have about 3 times as many records in that object as I should and it is overstating the data.
If I try to manually kick off the batch job, my browser hangs for 30-40 minutes before it says it was initiated and then it doesn't appear to be deleting any of the records.
This is the code I have inside the batch job.
Is there a better way to do this? Even when this was working early last week, it was taking a long time to process through the records.
Nightly this should be around 55K records being deleted. That number should grow, but shouldn't be significantly higher than what it is now. Because of the failed batch, right now, there are 189K records that need to be removed.
There are no after delete triggers setup on this object.
Deleting one of these records will not delete another. There are a couple relationships and deleting the other records in the relationship will delete these, but not vice-versa.
It doesn't say anything in the logs. I am unsure the exact time it took to complete. I had to manually run the batch job multiple times before it finished deleting all the records. It seemed to work for a while, but then would just stop like it had a timeout built in.
Yes, it does run nightly, but it can't get all the records done. Therefore, it is gradually increasing the number of records daily and is overstating the values, rendering the data useless.