I need to schedule anually a batch, on January 1st every year. This batch has to process all accounts to update a checkbox field. I'm trying to decide what is less expensive for the platform, so I can avoid hitting limits. My options:

  1. One batch. The query spans to one lookup relationship, bringing only one of those child records, depending on a specific check on them. Iterate the results, check the corresponding conditions and update the checkbox and bulk update the whole batch.
  2. Two batches. One for the records whose checkbox will be updated to true. Another for the ones which will get it updated to false. No need to check conditions because the queries already filtered the records appropriately. Then just iterate them and update the checkbox accordingly.

Which one is less expensive? Or is this irrelevant? If it's irrelevant, are there other factors that have to be taken into consideration? My concern has to do with the quantity of accounts.

1 Answer 1


Assuming the system is under light load, two batches will almost certainly finish faster than one. It really depends on if the queries are using indexes (affects start up time), how long each batch takes to finish, and if there will be potential conflicting row locks. The only real way to know would be to test it out in a sandbox.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .