Governor Limits in Salesforce :- In our previous Salesforce developer Training Tutorial we have learned about different visualforce sections in production. In this Salesforce Visualforce Tutorial we are going to learn about Governor limits in Salesforce.
Governor Limits in Salesforce.com
Governor Limits in Salesforce are the run time limits enforced by the apex runtime engine to write scalable and efficient code. Every programming environment imposes its own sets of constructs, features and constraints. All programs, services and applications running on the platform run in a multi-tenant environment where their resources like memory, network, database connections are being shared with every other program on the platform. Therefore it’s very important that the platform prevents rouge, runaway applications from saturating system resources.
- Force.com implements a number of governors and limits to ensure that all applications “play nicely” with each other.
- Governors are not evil.
- They often analyze our code to ensure that we are using best practices and system resources efficiently.
When developing custom applications, you have to actively take into consideration Apex governors and limits. The Apex runtime engine strictly enforces limits and issues a runtime exception if, for instance, a script exceeds a limit. Governor limits in Salesforce differ based upon the entry point of your code. For instance, when a Trigger is called from a Visualforce Controller the Apex runtime this limit on a case by case basis”
Suppose if we have developed any application with controller and the controller contains Save method bound to a command button. Now the governor limits counter starts to from Zero to one when a user clicks on save button. Like this if more number of methods present in a controller Governor limit counter keeps on increasing. Governor limits in Salesforce are of different which are used for different resource types like Heap, apex code, SOQL, record form SOQL, DML, Records in DML.
- Governor Limit for Heap is 3MB.
- We are able to execute 200, 000 lines of apex code.
- We have to use only 100 queries in SOQL queries.
- Total number of records for all SOQL queries are 50, 000.
- 150 DMl statements are only used.
- Total number of records in DML statements are 10,000 only.
For full details on Governor limits in salesforce.com check the following link : Governor Limits in SFDC.