October 11, 2021

"Your query request was running for too long" exception in Salesforce

Your query request was running for too long
[sf: QUERY_TIMEOUT]. Reason [QUERY_TIMEOUT: Your query request was running for too long.]

If the query runs more than 2 mins(120 seconds), the query times out and throw the exception.

To avoid long execution times, non-selective SOQL queries may be terminated by the system.

Maximum SOQL query run time before Salesforce cancels the transaction is 120 seconds(2 minutes). Check the following reference article.

Use "SOQL_EXECUTE_BEGIN" in the Debug Logs. Find the start time and the time of the exception. If it is 120 seconds, then optimize the query.

Make SOQL selective to resolve this issue.

No comments:

Post a Comment