0

So - I was always confused about the batch terminology. You can call Database.executeBatch to - you guessed it - execute a batch. But then again this "batch" also consists of a couple of batches. Does it make sense to call both the parts and the whole a batch? I find that incredibly confusing. How should we refer to both?

EDIT: To clarify this a bit more - my question is how we refer to this in our everyday life. I personally tend to call it batch job with N batches but that's not what I use throughout the day - I just call both of them batches. Which also comes from the fact that in Apex I refer to the whole batch job as batch. Since language-wise a batch is a collection of things this is actually true for both. So how can we communicate this without ambiguity, whether we're speaking with a user or a developer?

And this guy here is as confused as I am: https://developer.salesforce.com/forums/?id=906F0000000BL8SIAW

The confusion is real - just look how they are referred to in this question: How to execute batch class more than once in a test method?

2
  • 1
    The whole Operation is called batch, and each iteration is called as chunks. Jan 17, 2019 at 12:10
  • @PranayJaiswal Can you cite some sources for this? Or is it just personal preference?
    – Semmel
    Jul 25, 2019 at 9:50

1 Answer 1

2

When you call Database.executeBatch(), it does not execute a batch, rather it executes a batch class. Within batch class, it splits the data into chunks depending on the batch size provided. And the chunk of records which are created after split is called as batch (i.e. each chunk is called as batch). You can specify the number of records which should be processed in single batch by providing the batch size (default is 200 and maximum is 2000). And that chunk (batch) of records are passed one by one (i.e. each chunk at a time) to execute method to perform the necessary operations.

You can refer Asynchronous Apex trailhead module for more information.

1
  • I clarified my question a bit as I think that most of the confusion comes from developers having their batches named batch, not job. I guess I'll just go with batch job and batch in the meantime
    – Semmel
    Jul 25, 2019 at 10:05

You must log in to answer this question.

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