Salesforce Governor Limits


                        Salesforce Governor Limits

 
Since Apex runs in a multitenant environment, the Apex run time engine strictly enforces a number of limits to ensure that runaway Apex does not monopolize shared resources. These limits, or governors, track and enforce the statistics outlined in the following table. If some Apex code ever exceeds a limit, the associated governor issues a run time exception that cannot be handled.



Description
Limit
Total number of SOQL queries issued
100
Total number of SOQL queries issued for Batch Apex and future methods
200
Total number of records retrieved by SOQL queries
50,000
Total number of records retrieved by Database.getQueryLocator
10,000
Total number of SOSL queries issued
20
Total number of records retrieved by a single SOSL query
200
Total number of DML statements issued
150
Total number of records processed as a result of DML statements,Approval.process, or database.emptyRecycleBin
10,000
Total number of executed code statements
200,000
Total number of executed code statements for Batch Apex and future methods
1,000,000
Total heap size
6 MB
Total heap size for Batch Apex and future methods
12 MB
Total stack depth for any Apex invocation that recursively fires triggers due toinsert, update, or delete statements
16
For loop list batch size
200
Total number of callouts (HTTP requests or Web services calls) in a request
10
Maximum timeout for all callouts (HTTP requests or Web services calls) in a request
120 seconds
Default timeout of callouts (HTTP requests or Web services calls) in a request
10 seconds
Total number of methods with the future annotation allowed per Apex invocation
10
Maximum size of callout request or response (HTTP request or Web services call)
3 MB
Total number of sendEmail methods allowed
10
Total number of describes allowed
100
Total number of classes that can be scheduled concurrently
25
Total number of test classes that can be queued per a 24–hour period
The greater of 500 or 10 multiplied by the number of test classes in the organization

Visualforce Limits

Available in: Contact Manager, Group, Professional, Enterprise,Performance, Unlimited, and Developer Editions


Limit

Value

Maximum response size for a Visualforce page

Less than 15 MB

Maximum view state size in a Visualforce page

135KB

Maximum size of a Visualforce email template

1 MB

Maximum file size for a file uploaded using a Visualforcepage

10 MB

Maximum size of HTML response before rendering, whenVisualforce page is rendered as PDF

Less than 15 MB

Maximum PDF file size for a Visualforce page rendered as a PDF

60 MB

Maximum total size of all images included in a Visualforcepage rendered as a PDF

30 MB

Maximum response size of a JavaScript remote call

15 MB

Default timeout for a JavaScript remoting call

30000milliseconds (30seconds)

Maximum timeout for a JavaScript remoting call

120000milliseconds (120seconds)

Maximum number of rows retrieved by queries for a singleVisualforce page request

50,000

Maximum number of rows retrieved by queries for a singleVisualforce page request in read-only mode

1 million

Maximum number of collection items that can be iterated in an iteration component such as <apex:pageBlockTable> and<apex:repeat>

1,000

Maximum number of collection items that can be iterated in an iteration component such as <apex:pageBlockTable> and<apex:repeat> in read-only mode

10,000

Maximum number of field sets that can be displayed on a single Visualforce page.

50

Maximum number of records that can be handled by StandardSetController

10,000



SOQL and SOSL Limits

Feature

Limit

Limit Description

SOQL statements

Maximum length of SOQL statements

By default, SOQL statements cannot exceed 20,000 characters in length.

SOSL statements

Maximum length of SOSL statements

The SOSL statement character limit is tied to the SOQL statement character limit defined for your organization. By default, SOQL and SOSL queries cannot exceed 20,000 characters.

SOSL search query strings

Maximum length ofSearchQuerystring

If the SearchQuery string is longer than 10,000 characters, no result rows are returned. If SearchQuery is longer than 4,000 characters, any logical operators are removed. For example, the ANDoperator in a statement with aSearchQuery that’s 4,001 characters will default to the OR operator, which could return more results than expected.

SOSL query results

Maximum number of rows returned

2,000 results total (API version 28.0 and later), unless you specify custom limits in the query. Previous API versions return 200 results.

Relationship queries

Relationship query limits

·         No more than 35 child-to-parent relationships can be specified in a query. A custom object allows up to 25 relationships, so you can reference all the child-to-parent relationships for a custom object in one query.
·         No more than 20 parent-to-child relationships can be specified in a query.
·         In each specified relationship, no more than five levels can be specified in a child-to-parent relationship. For example,Contact.Account.Owner.FirstName(three levels).
·         In each specified relationship, only one level of parent-to-child relationship can be specified in a query. For example, if the FROM clause specifies Account, the SELECT clause can specify only the Contact or other objects at that level. It could not specify a child object of Contact.

 

FOR VIEW and FOR REFERENCE

MaximumRecentlyViewedrecords allowed

The RecentlyViewed object is updated every time the logged-in user views or references a record. It is also updated when records are retrieved using the FOR VIEW or FOR REFERENCE clause in a SOQL query. To ensure that the most recent data is available, RecentlyViewed data is periodically truncated down to 200 records per object.

OFFSET clause

Maximum number of rows skipped by OFFSET

·he maximum offset is 2,000 rows. Requesting an offset greater than 2,000 will result in aNUMBER_OUTSIDE_VALID_RANGE error.

ORDER BY clause in SOQL statement

ORDER BY fields limit

32 fields

Metadata Limits


The following are limits for deploying and retrieving metadata. These limits apply to the Force.com IDE, the Force.com Migration Tool, and the Metadata API.

Metadata Limit
                Limit Description
Retrieving and deploying metadata
Metadata API can deploy and retrieve up to 5,000 filesor 400 MB at one time.
While a specific file size limit is not enforced, you might encounter out-of-memory errors for very large files.

Change sets
Inbound and outbound change sets can have up to5,000 files of metadata.
Learn more »

Type of Application Programming Interface (API) in Salesforce

API Name
What It’s For
When to Use It
Protocol
Data Format
Communication
REST API
Accessing objects in your organization using REST.
You want to leverage the REST architecture to integrate with your organization. No WSDL requirement.Well-suited for browser-based applications, mobile apps, and highly-interactive social applications.
REST
JSON, XML
Synchronous
SOAP API
Integrating your organization’s data with other applications using SOAP.
You have pre-existing middleware services that need to work with WSDLs and XML data.
SOAP/WSDL
XML
Synchronous
Chatter REST API
Accessing Chatter feeds and social data such as users, groups, followers, and files using REST.
You want to integrateChatter into a variety of applications, such as mobile apps, intranet sites, and third-party Web applications.
REST
JSON,
  XML

Synchronous (photos are processed asynchronously)
Bulk API
Loading or deleting large numbers of records.
You have over a million records to process and speed is a requirement.
REST
csv,xml
Asynchronous
Metadata API

Managing customizations in your organization and building tools that can manage the metadata model, not the data itself.
You want to migrate changes, such as custom object definitions and page layouts, from a sandbox to your production environment.
SOAP/WSDL
XML
Asynchronous
Streaming API
Providing a stream of data reflecting data changes in your organization.
You need near real-time notifications of when records are created or updated.
Bayeux
JSON
Asynchronous (stream of data)
Apex REST API
Building your own REST API in Apex. ExposesApex classes as RESTful Web services.
You need to build custom JSON responses or you want to expose custom functionality that you implemented in Apex.
REST
JSON, XML, Custom
Synchronous
Apex SOAP API

Creating custom SOAP Web services in Apex. Exposes Apex classes as SOAP Web services.
You need to build custom XML responses or you want to expose custom functionality that you implemented in Apex .
SOAP/WSDL
XML
Synchronous
Tooling API


Building custom development tools forForce.com applications
You want to add functionality to your existing development and integration tools or you want to build specialized development tools for a specific application or service.
REST and SOAP
JSON, XML, Custom
Asynchronous

Learn more »