+ Start a Discussion
mohammed kingmohammed king 

1. how many ways to schedule batch apex 2. in execute method how many records we can fetch 3. difference between batch apex and schedule apex

Sunil RathoreSunil Rathore
Hi Mohammed,

Please refer the below link for the detailed description of Batch Apex:

Let me know if it helps you.

Many Thanks,
Sunil Rathore
Deepali KulshresthaDeepali Kulshrestha
Hi mohammed,
Please follow the given below points with the help of these, you can solve your problem, it may be helpful to you.

How many ways to schedule batch apex, Apex Batches can be scheduled through :

1. Salesforce UI > Classes > Schedule Apex
2. Custom Solution e.g. via some custom visualforce interface
3. Called via Apex/DML Events in the system e.g. Update of X, Schedule Batch Y

In execute() method how many records we can fetch :

1. 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.

Difference between the batch apex and schedule apex :
Scheduling apex:
1. To execute any class at a specific time we use scheduling apex.

Batch Apex:
1. It divides the whole process into batches (each batch handles 200 records at a time).
To handle a large number of data we have to batch apex.
Also used to overcome the governing limits.

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha
Bhaskar MuliBhaskar Muli
Hi Deepali ,

Can you please explain me the 2nd approach for schedule job (Custom solution)?