Here is some Salesforce Governor Limits:-
Sr. No. | Name | Limits |
1 | Number of SOQL Query | 100 |
2 | Number of records retrieved by a single SOQL Query | 50,000 |
3 | Number of records retrieved by Database.getQueryLocator | 10,000 |
4 | Number of SOSL queries issued | 20 |
5 | Number of records retrieved by a single SOSL query | 2,000 |
6 | Number of DML statements issued | 150 |
7 | Stack Depth for recursive Trigger firing | 16 |
8 | Number of HTTP or Web service callouts | 100 |
9 | Maximum Future Calls Allowed | 50 |
10 | Maximum Queueable Calls Allowed | 50 |
11 | Maximum Send Email Methods | 10 |
12 | Total Heap Size | 6MB |
13 | Maximum EventBus. Publish Calls | 150 |
14 | Maximum CPU time on Salesforce Servers | 10,000 milliseconds |
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.