Here is some Salesforce Governor Limits:-

Sr. No.NameLimits
1Number of SOQL Query100
2Number of records retrieved by a single SOQL Query50,000
3Number of records retrieved by Database.getQueryLocator10,000
4Number of SOSL queries issued20
5Number of records retrieved by a single SOSL query2,000
6Number of DML statements issued150
7Stack Depth for recursive Trigger firing16
8Number of HTTP or Web service callouts100
9Maximum Future Calls Allowed50
10Maximum Queueable Calls Allowed50
11Maximum Send Email Methods10
12Total Heap Size6MB
13Maximum EventBus. Publish Calls150
14Maximum CPU time on Salesforce Servers10,000

Additional Points:-

3. Database.getQueryLocator will return 50 million records only if it is used in the Start method of the class which implements the Database.Batchable interface. If you use QueryLocator methods in execute or finish methods, the governor limits are not bypassed and will only return 10,000 records.

The same goes for the synchronous apex. If you use this method in synchronous apex methods, the QueryLocator method is going to return only 10,000 records, which is even lesser than a simple SOQL query which returns 50,000 rows per transaction. So the best practice to get records and bypass the governor limits is to use the QueryLocator in the start method of the batch apex.


Leave a Reply

Your email address will not be published.