Find your content:

Search form

You are here

Batch Apex Average Time

 
Share

I scheduled a batch apex class to delete around 350,000 records on Friday evening, the process has been running over the weekend and this morning it's still on the batch 416 out of 1668, is it normal for batch apex to take such a long time?. There are no dependencies on this deletion but I am curious as to why it's taking so long. Perhaps, it's because I didn't specify a batch size and it's running on the default batch size?

public void QueueCleaner(){

String query = 'SELECT id FROM Case WHERE OwnerId = \'00G50000001Pdd2EAC\'';

            BatchJunkDelete batchApex = new BatchJunkDelete(query );
            ID batchprocessid = Database.executeBatch(batchApex);


            }

Attribution to: PepeFloyd

Possible Suggestion/Solution #1

Basically its an async job .Asynchronous apex executes when resources get available in the salesforce servers so its normal that sometimes it takes time .

There can be one more reason is your code .If its not optimised it may take time .

Also if it was only for simply deleting using bulk API or data loader enabled with bulk API would have processed your job quicker.


Attribution to: Mohith Shrivastava

Possible Suggestion/Solution #2

Worth checking in the Setup > Monitoing > Apex Jobs - checks if you can see instances of your regularly updating . Check the LastModiiedDate to see when the last update was. If it hasn't progressed you might have to abort and restart.

A whole weekend for 350K records doesn't sound right unless there is some crazy complex processing.

The default batch size is 200, so you should be alright.


Attribution to: techtrekker
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/2007

My Block Status

My Block Content