You need to sign in to do that
Don't have an account?
Diptiman Prusty 9
Number of query rows APEX resource warning
I am trying to find duplicate cases for a particular case . Below are the queries that are used in APEX :
Total number of records in Cases object is 200000 +
First this query :
SELECT PONumber__c,Tracking_Number__c,Customer_Full_Name__c,Id, CaseNumber FROM Case WHERE Id =: strParentCaseId
Then below queries in a for loop( passing through the list of strFieldValues :
SELECT COUNT(Id) recCount FROM Case WHERE Id !=: strParentCaseId AND PONumber__c != NULL AND PONumber__c =: strFieldValue LIMIT 1000
SELECT COUNT(Id) recCount FROM Case WHERE Id !=: strParentCaseId AND Tracking_Number__c != NULL AND Tracking_Number__c =: strFieldValue LIMIT 1000
SELECT COUNT(Id) recCount FROM Case WHERE Id !=: strParentCaseId AND Customer_Full_Name__c != NULL AND Customer_Full_Name__c =: strFieldValue LIMIT 1000
But still I am getting the APEX resource warning for number of query rows. Not sure which query is the culprit here.
Total number of records in Cases object is 200000 +
First this query :
SELECT PONumber__c,Tracking_Number__c,Customer_Full_Name__c,Id, CaseNumber FROM Case WHERE Id =: strParentCaseId
Then below queries in a for loop( passing through the list of strFieldValues :
SELECT COUNT(Id) recCount FROM Case WHERE Id !=: strParentCaseId AND PONumber__c != NULL AND PONumber__c =: strFieldValue LIMIT 1000
SELECT COUNT(Id) recCount FROM Case WHERE Id !=: strParentCaseId AND Tracking_Number__c != NULL AND Tracking_Number__c =: strFieldValue LIMIT 1000
SELECT COUNT(Id) recCount FROM Case WHERE Id !=: strParentCaseId AND Customer_Full_Name__c != NULL AND Customer_Full_Name__c =: strFieldValue LIMIT 1000
But still I am getting the APEX resource warning for number of query rows. Not sure which query is the culprit here.
If you want to access more than 50000 records.You need to write a batch class.
- http://boards.developerforce.com/t5/Apex-Code-Development/Fetch-more-than-50000-records-by-SOQL/td-p/359733 (https://developer.salesforce.com/forums?id=906F000000090EEIAY)
- https://developer.salesforce.com/forums?id=906F000000090EEIAY
I hope it will be helpful.Please mark it as Best Answer if the information is informative.
Best Regards
Rahul Kumar