Salesforce Governor Limits


Total number of SOQL queries issued1
100
Total number of SOQL queries issued for Batch Apex and future methods1
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
2000
Total number of DML statements issued2
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 size3
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 to insert, update, or delete statements4
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 invocation5
10
Maximum size of callout request or response (HTTP request or Web services call)6
3 MB
Total number of sendEmail methods allowed
10
Total number of describes allowed7
100
Total number of classes that can be scheduled concurrently
100
Total number of test classes that can be queued per a 24-hour period8
The greater of 500 or 10 multiplied by the number of test classes in the organization

 3 Email services heap size is 36 MB.     
 4 Recursive Apex that does not fire any triggers with insert, update, or delete statements exists in a single invocation, with a single stack.
 5 The maximum number of future method invocations per a 24-hour period is 250,000 or the number of user licenses in your organization multiplied by 200, whichever is greater. This is an organization-wide limit and is shared with all other asynchronous Apex: batch Apex and scheduled Apex. The licenses that count toward this limit are full Salesforce user licenses and Force.com App Subscription user licenses. Chatter Only, Chatter customer users, Customer Portal User, and partner portal User licenses aren’t included.
 8 This limit applies to tests running asynchronously. This includes tests started through the Salesforce user interface including the Developer Console or by inserting ApexTestQueueItem objects using SOAP API.
Use the Limits methods to determine the code execution limits for your code while it is running. For example, you can use the getDMLStatements method to determine the number of DML statements that have already been called by your program, or the getLimitDMLStatements method to determine the total number of DML statements available to your code.
For Apex saved using Salesforce.com API version 20.0 or earlier, if an API call causes a trigger to fire, the chunk of 200 records to process is further split into chunks of 100 records. For Apex saved using Salesforce.com API version 21.0 and later, no further splits of API chunks occur. Note that static variable values are reset between API batches, but governor limits are not. Do not use static variables to track state information between API batches.
      The maximum number of characters for a class is 1 million.
      The maximum number of characters for a trigger is 1 million.The maximum amount of code used by all Apex code in an organization is 3 MB. Note
      If a SOQL query runs more than 120 seconds, the request can be canceled by Each Apex request is limited to 10 minutes of execution.
      A callout request is limited to a maximum of 20 simultaneous requests to URLs with the same host. The host is defined by the unique subdomain for the URL, for example, www.mysite.com and extra.mysite.com are two different hosts. This limit is calculated across all organizations that access the same host. If this limit is exceeded, a CalloutException will be thrown.

      The maximum number of records that an event report returns for a user who is not a system administrator  20,000, for system administrators, 100,000.
      A user can have up to 50 query cursors open at a time. For example, if 50 cursors are open and a client application still logged in as the same user attempts to open a new one, the oldest of the 50 cursors is released. Note that this limit is different for the batch Apexstart method, which can have up to five query cursors open at a time per user. The other batch Apex methods have the higher limit of 50 cursors.
Cursor limits for different Force.com features are tracked separately. For example, you can have 50 Apex query cursors, 50 batch cursors, and 50 Visualforce cursors open at the same time.
Batch Apex Governor Limits
           Keep in mind the following governor limits for batch Apex:
      Up to five queued or active batch jobs are allowed for Apex.
      The maximum number of batch Apex method executions per a 24-hour period is 250,000 or the number of user licenses in your organization multiplied by 200, whichever is greater.
      A maximum of 50 million records can be returned in the Database.QueryLocator object. If more than 50 million records are returned, the batch job is immediately terminated and marked as Failed.
      If the start method returns a QueryLocator, the optional scope parameter of Database.executeBatch can have a maximum value of 2,000. If set to a higher value, Salesforce chunks the records returned by the QueryLocator into smaller batches of up to 2,000 records. If the start method returns an iterable, the scope parameter value has no upper limit; however, if you use a very high number, you may run into other limits.
      If no size is specified with the optional scope parameter of Database.executeBatch, Salesforce chunks the records returned by the start method into batches of 200, and then passes each batch to the execute method. Apex governor limits are reset for each execution of execute.
      The start, execute, and finish methods can implement up to 10 callouts each.
      Batch executions are limited to 10 callouts per method execution.

Apex Scheduler Limits
      You can only have 100 scheduled Apex jobs at one time. .
Email Limits
Inbound Email Limits
Email Services: Maximum Number of Email Messages Processed
(Includes limit for On-Demand Email-to-Case)
Number of user licenses multiplied by Number of user licenses multiplied by 1,000, up to a daily maximum of 1,000,000
Email Services: Maximum Size of Email Message (Body and Attachments)
10 MB1
On-Demand Email-to-Case: Maximum Email Attachment Size
10 MB
On-Demand Email-to-Case: Maximum Number of Email Messages Processed
(Counts toward limit for Email Services)
Number of user licenses multiplied by 1,000, up to a daily maximum of 1,000,000

 The maximum size of email messages for Email Services varies depending on language and character set.
When defining email services, note the following:
      An email service only processes messages it receives at one of its addresses.
      Salesforce limits the total number of messages that all email services combined, including On-Demand Email-to-Case, can process daily. Messages that exceed this limit are bounced, discarded, or queued for processing the next day, depending on how you configure the failure response settings for each email service. Salesforce calculates the limit by multiplying the number of user licenses by 1,000, up to a daily maximum of 1,000,000. For example, if you have ten licenses, your organization can process up to 10,000 email messages a day.
      Email service addresses that you create in your sandbox cannot be copied to your production organization.
      For each email service, you can tell Salesforce to send error email messages to a specified address instead of the sender's email address.
Outbound Email: Limits for Single and Mass Email Sent Using Apex
Using the API or Apex, you can send single emails to a maximum of 1,000 external email addresses per day based on Greenwich Mean Time (GMT). Single emails sent using the Salesforce application don't count toward this limit. There’s no limit on sending individual emails to contacts, leads, person accounts, and users in your organization directly from account, contact, lead, opportunity, case, campaign, or custom object pages.
When sending single emails, keep in mind:
      You can send 100 emails per SingleEmailMessage.
      If you use SingleEmailMessage to email your organization’s internal users, specifying the user’s ID in setTargetObjectId means the email doesn’t count toward the daily limit. However, specifying internal users’ email addresseses in setToAddresses means the email does count toward the limit.

Edition
External Address Limit per Mass Email
Personal, Contact Manager, and Group Editions
Mass email not available
Professional Edition
250
Enterprise Edition
500
Unlimited Edition
1,000


You can send mass email to a maximum of 1,000 external email addresses per day per organization based on Greenwich Mean Time (GMT). The maximum number of external Use SOQL when

      You know in which objects or fields the data resides.
      You want to retrieve data from a single object or from multiple objects that are related to one another.
      You want to count the number of records that meet specified criteria.
      You want to sort results as part of the query.
      You want to retrieve data from number, date, or checkbox fields.
Use SOSL when
      You don't know in which object or field the data resides and you want to find it in the most efficient way possible.
      You want to retrieve multiple objects and fields efficiently, and the objects may or may not be related to one another.

      You want to retrieve data for a particular division in an organization using the divisions feature, and you want to find it in the most efficient way possible.

No comments:

Post a Comment