To make your Apex code run as a batch, you must sign a contract with the platform. This contract takes the form of an interface called
Batchable that must be implemented by your code. It requires that you structure your processing logic into the following three methods:
start method is concerned with the scope of work, the raw set of records to be processed in the batch. When a batch is submitted to Salesforce for processing, the first thing it does is invoke your
start method. Your job here is to return a
QueryLocator or an
Iterable that describes the scope of the batch job.
execute—After calling ...