Mytutorialrack

In this blog post we will learn about Governor limits. As Apex executes on the force.com platform, which is run on a shared tenancy architecture, Salesforce imposes certain limits as to the level of resources consumed within a single thread by applications built on the platform. These limits are collectively known as Governor Limits. These limits affect a number of different things, but the most common ones are denoted here; what they affect or limit, and how to work around those limits, will be explained in greater detail throughout the remainder of the series.

Note Remember, Governor Limits are subject to change, and tend to do so between releases. Any specific numbers provided in this post should be assumed to be general guidelines and subject to change.

Script Statements

This limit is also related to total execution time. It can really only be hit if you are performing a large number of loop operations. Typically, you would have to use nested loops several times or levels deep to hit this limit or to have an endless loop (but that is another problem entirely, and one you should fix quickly).

Heapsize

RAM, memory, heap: heapsize just means how much memory your application is taking up. This is a very rare error to run into unless you are actively manipulating files directly in your Apex code. Typically, operations like that are best offloaded to external services, but on occasion, it is something that can be done natively (on the platform). The current heapsize limit is 5MB, meaning that if you are manipulating files, your total memory use of the application (per thread) must be under 6MB, so your file has to also be smaller so as to leave room for logic.

Queries

Queries against the database have two separate limits to watch out for. First off, you may only perform 100 query actions against the database in total per thread. This is a total per thread: it does not matter how you break your code up across classes or methods, it will all count together as long as it occurs within the same thread. This is also true for the other query limit regarding the number of rows which can be retrieved from the database. The cap on rows retrieved in total in a single thread is 50,000 rows (records).

DML

As with query limits, there are two different DML (Data Manipulation Language ) limits. DML statements are any statements which directly interact with the database to write to it. This includes inserts, updates, deletes, and undeletes. In a single thread, there can be a total of 150 DML statements, affecting a total of 10,000 rows.

Callouts

A callout is a request to an external server over the Internet. At present, a single thread can execute 100 callouts, with a total processing time of two minutes across all callouts combined.

To learn more

Share:

Recent Posts