Why governor limits?
Governor limits are enforced to ensure that code runs correctly without any error. Governor limits ensured that you write correct code considering best practices.
Limits value:
SOQL queries per transaction.
==>100.(synchronous)
==>100.(synchronous)
SOQL queries per transaction.
==>200(asynchronous)
==>200(asynchronous)
Number of record retrieve by SOQL query ==>50000.
dml statements per transaction
==> 150
==> 150
Number of records proceeds by dml statement.
==> 10000
==> 10000
Total number of SOSL query:
==>20
==>20
Number of record retrieve by SOSL Statement ==>2000
Number of future method call per Apex transaction.
==>50
==>50
Number of Apex jobs in queue.
==>50
==>50
Heap size limit.
==> 6 MB ( synchronous)
12 MB ( asynchronous)
==> 6 MB ( synchronous)
12 MB ( asynchronous)
Note: Refer list for Loop vs soql for Loop article for example on heap size error.
SOQL List vs SOQL For Loop
SOQL List vs SOQL For Loop
How to avoid hitting governor limits in test method ?
- Using Test.startTest() method.
1) Avoid writing for loop inside the method.
2)Use soql for Loop instead of a list for Loop.
3)use Test.startTest() method inside test method to reset governor limits.
4)Do not update setup objects like user role with other objects in the same transaction.
2)Use soql for Loop instead of a list for Loop.
3)use Test.startTest() method inside test method to reset governor limits.
4)Do not update setup objects like user role with other objects in the same transaction.
***********************************************************************************************************
TAGS:Governor limit in salesforce,Salesforce Governor Limits,how to handle governor limits in salesforce,how to overcome governor limits in salesforce,governor limit exception in salesforce.
***********************************************************************************************************
TAGS:Governor limit in salesforce,Salesforce Governor Limits,how to handle governor limits in salesforce,how to overcome governor limits in salesforce,governor limit exception in salesforce.
***********************************************************************************************************
No comments:
Post a Comment