SalesforceBlue

Feel the rhythm of Salesforce

Governor Limits

Salesforce Governor Limits Simplified

Consider you are living in a hostel with two other roommates. The hostel management will ensure that you get an equal bed, table & chairs, and other necessary items. There will be certain rules which ensure a room can have a maximum occupancy of 3. The hostel gate should be closed by 11 PM and so on.

In order to govern things, hostel management will appoint a warden who would keep a check on everything to ensure things are operating fairly and smoothly.

Similarly, Salesforce has a multi-tenant architecture so its resources are shared across. Salesforce has to ensure that resources are equally used and not dominated by one tenant. To ensure this Salesforce has governor limits to which every tenant has to adhere.

Please note that some limits are shared across the org irrespective of the package and some limits are applied to the respective packages only.

For Example, the Total number of SOQL queries issued governor limits for a managed package is not counted against other managed package code. However, the CPU time limit is common to all Apex code including all the packages installed in the org.

As of writing below are the governor limits for an Apex transaction :

DescriptionSynchronous LimitAsynchronous Limit
Total number of SOQL queries issued100200
Total number of records retrieved by SOQL queries50,000
Total number of records retrieved by Database.getQueryLocator10,000
Total number of SOSL queries issued20
Total number of records retrieved by a single SOSL query2,000
Total number of DML statements issued150
Total number of records processed as a result of DML statements, Approval.process, or database.emptyRecycleBin10,000
Total stack depth for any Apex invocation that recursively fires triggers due to insertupdate, or delete statements16
Total number of callouts (HTTP requests or web services calls) in a transaction100
Maximum cumulative timeout for all callouts (HTTP requests or Web services calls) in a transaction120 seconds
Maximum number of methods with the future annotation allowed per Apex invocation500 in batch and future contexts;
1 in queueable context
Maximum number of Apex jobs added to the queue with System.enqueueJob501
Total number of sendEmail methods allowed10
Total heap size6 MB12 MB
Maximum CPU time on the Salesforce servers510,000 milliseconds60,000 milliseconds
Maximum execution time for each Apex transaction10 minutes
Maximum number of push notification method calls allowed per Apex transaction10
Maximum number of push notifications that can be sent in each push notification method call2,000
Maximum number of EventBus.publish calls for platform events configured to publish immediately150

Governor limits are subject to change release to release.

Here is the link for Salesforce Governor limits which includes all the limits categories and their values – https://developer.salesforce.com/docs/atlas.en-us.salesforce_app_limits_cheatsheet.meta/salesforce_app_limits_cheatsheet/salesforce_app_limits_platform_apexgov.htm

We should always design our solution considering the potential breach of governor limits in near future. It could be that while developing and unit testing things look good and to avoid any sudden surprise in production we must adhere to best practices while designing and implementing solutions 🙂

Thank you for visiting SalesforceBlue.com
If you have any queries feel free to write down a comment below 🙂


3 thoughts on “Salesforce Governor Limits Simplified

  • Great job site admin! You have made it look so easy talking about that topic, providing your readers some vital information. I would love to see more helpful articles like this, so please keep posting! I also have great posts about Thai-Massage, check out my weblog at QN9

    Reply
  • It appears that you know a lot about this topic. I expect to learn more from your upcoming updates. Of course, you are very much welcomed to my website UY3 about Airport Transfer.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *