Activity › Forums › Salesforce® Discussions › Why to use batch class instead of normal class in Salesforce?
-
Why to use batch class instead of normal class in Salesforce?
Posted by MOHIT on August 26, 2020 at 1:24 PMWhy to use batch class instead of normal class in Salesforce?
Marziya replied 5 years, 9 months ago 5 Members · 4 Replies -
4 Replies
-
Batch class in salesforce is used to run large jobs (think thousands or millions of records!) that would exceed normal processing limits. Using Batch Apex, you can process records asynchronously in batches (hence the name, “Batch Apex”) to stay within platform limits.
- [adinserter block='9']
-
There are various reasons why Batch Apex is better than Normal Apex.
- A Normal Apex uses 100 records per cycle to execute SOQL queries. Whereas, a Batch Apex does the same in 200 records per cycle. So, it is very fast when the execution of SOQL queries is considered.
- A Normal Apex can retrieve 50,000 SOQL queries but, in Batch Apex, 50,000,000 SOQL queries can be retrieved.
- A Normal Apex has a heap size of 6 MB; whereas, a Batch Apex has a heap size of 12 MB.
- When executing bulk records, Normal Apex classes are more vulnerable to encountering errors as compared to Batch Apex. The latter is normally error-less.
-
Batch class in salesforce is used to run large jobs (think thousands or millions of records!) that would exceed normal processing limits. Using Batch Apex, you can process records asynchronously in batches (hence the name, “Batch Apex”) to stay within platform limits.
-
- A Normal Apex has a heap size of 6 MB; whereas, a Batch Apex has a heap size of 12 MB.
- When executing bulk records, Normal Apex classes are more vulnerable to encountering errors as compared to Batch Apex. The latter is normally error-less.
Log In to reply.