2

I am trying to find the total number of records (volume) an APEX batch is capable of processing overall. Can someone please help me in this.

  • Need to know the volume not limit

Question # 69265 on SOF gives batch limits

Thanks

3

Providing the start method returns a QueryLocator (and not the Iterator alternative), a single batchable can process 50 million records:

A maximum of 50 million records can be returned in the Database.QueryLocator object. If more than 50 million records are returned, the batch job is immediately terminated and marked as Failed.

Each call to the execute method must stay within the other governor limits, but that can usually be achieved by selecting a batch size that is small enough. So for example 20 million records could be processed using a batch size of 1,000 records so the execute method gets called 20,000 times.

2
  • Can you confirm that using an Iterator limits record count to 50,000 (i.e. standard SOQL record limit)? – Mossi Apr 25 '17 at 3:12
  • @Mossi Yes that is my understanding per the docs that say "If you use an iterable, the governor limit for the total number of records retrieved by SOQL queries is still enforced" which is 50,000. – Keith C Apr 25 '17 at 7:09
1

The answer to your question is subject to the task or transaction at hand. The reason for using a batch:

when you have many operations for each record being passed in and are running into governor limits. By limiting the number of records, you are limiting the operations per transaction.

Using Batch Apex (Documentation)

A maximum of 50 million records can be returned in the Database.QueryLocator object. If more than 50 million records are returned, the batch job is immediately terminated and marked as Failed.

Keep in mind that if your batch iteration grabs too large a number of records than you may still run into governing limits

Database.executeBatch can have a maximum value of 2,000 [...records per iteration in your batch]

With Apex Flex Queue, you can submit up to 100 batch jobs without getting an error.

The outcome of Database.executeBatch is as follows. The batch job is placed in the Apex flex queue, and its status is set to Holding. If the Apex flex queue has the maximum number of 100 jobs, Database.executeBatch throws a LimitException and doesn’t add the job to the queue.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.