Newer Version Available

This content describes an older version of this product. View Latest

Future Methods with Higher Limits (Pilot)

This feature is currently available to select customers through a pilot program. To be nominated to join this pilot program, contact Salesforce. Additional terms and conditions may apply to participate in the pilot program. Please note that pilot programs are subject to change, and as such, we cannot guarantee acceptance into this pilot program or a particular time frame that this feature can be enabled. Any unreleased services or features referenced in this or other press releases or public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make their purchase decisions based upon features that are currently available.

Note

Apex future methods (methods that are annotated with @future) currently have the higher asynchronous limits for heap size, CPU timeout, and number of SOQL queries. This pilot enables you to specify even higher values for these and for additional limits in future methods. If you were exceeding a governor limit in your future method, or if you think a future method requires a higher limit, you can increase this limit for your future method.

Running future methods with higher limits might slow down the execution of all your future methods.

Note

One of the following limits can be doubled or tripled for each future method.
  • Heap size
  • CPU timeout
  • Number of SOQL queries
  • Number of DML statements issued
  • Number of records that were processed as a result of DML operations, Aprroval.process, or Database.emptyRecycleBin
The higher limit is specified in the method definition as part of the @future annotation by using the limit parameter, in the following syntax:
1@future(limits='2x|3xlimitName')
2
For example, to double the amount of heap size that is allowed in your future method, define your method as follows:
1@future(limits='2xHeap')
2public static void myFutureMethod() {
3    // Your code here
4}

Keep in mind that you can specify only one higher limit per future method. Decide which of the modifiable limits you need the most for your method.

Tip

The following limit modifiers are supported. The string value passed to the limits parameter inside the annotation is case-insensitive.

Modifier Description
@future(limits='2xHeap') Heap size limit is doubled (24 MB).
@future(limits='3xHeap') Heap size limit is tripled (36 MB).
@future(limits='2xCPU') CPU timeout is doubled (120,000 milliseconds).
@future(limits='3xCPU') CPU timeout is tripled (180,000 milliseconds).
@future(limits='2xSOQL') Number of SOQL queries limit is doubled (400).
@future(limits='3xSOQL') Number of SOQL queries limit is tripled (600).
@future(limits='2xDML') Number of DML statements limit is doubled (300).
@future(limits='3xDML') Number of DML statements limit is tripled (450).
@future(limits='2xDMLRows')1 Number of records that were processed as a result of DML operations is doubled (20,000).
@future(limits='3xDMLRows')1 Number of records that were processed as a result of DML operations is tripled (30,000).

1 Includes Aprroval.process and Database.emptyRecycleBin operations.