You need to sign in to do that
Don't have an account?
Gaurav Agnihotri
Too Many Query Rows:50001
Hello,
I am in a process of understanding developer console log and the best and fastest way to resolve "Too Many Query Rows:50001" error.
In general there seems to be two methods to diagnose this issue.
1. filter the log on SOQL_EXECUTE_LOG to track the result of each query
2. Execute limit on Execution overview to track result of each SOQL query used in the code.
I tend to lean toward number 2, but i could be wrong. what would you guys recommend?
is there any other place in the developer console where i can look for this information faster.
Thanks in advance,
Gaurav
I am in a process of understanding developer console log and the best and fastest way to resolve "Too Many Query Rows:50001" error.
In general there seems to be two methods to diagnose this issue.
1. filter the log on SOQL_EXECUTE_LOG to track the result of each query
2. Execute limit on Execution overview to track result of each SOQL query used in the code.
I tend to lean toward number 2, but i could be wrong. what would you guys recommend?
is there any other place in the developer console where i can look for this information faster.
Thanks in advance,
Gaurav
The exception is being thrown because the maximum number of rows you can return in SOQL calls in Apex is 50000.
You will need to use Batch Apex, in which the 50k limit counts per batch execution
These limits count for each Apex transaction. For Batch Apex, these limits are reset for each execution of a batch of records in the execute method
Can you limit the results by adding either some more where criteria or using a LIMIT 50000 statement in the soql.
All Answers
The exception is being thrown because the maximum number of rows you can return in SOQL calls in Apex is 50000.
You will need to use Batch Apex, in which the 50k limit counts per batch execution
These limits count for each Apex transaction. For Batch Apex, these limits are reset for each execution of a batch of records in the execute method
Can you limit the results by adding either some more where criteria or using a LIMIT 50000 statement in the soql.
Thanks for your reply. The requirement is such that I have to get results in realtime. Therefore, I can not use batch apex. I am trying to filter the log on SOQL_EXECUTE_LOG but it does not show me the SOQL that is causing this issue. Is there any other way i could find the component that is returning an unexpected number of rows?
I did that and found execute limit on execution overview to be better. It displayed the SOQL that was returning too many rows. It was very good. Very good feature.