You need to sign in to do that
Don't have an account?
Sam.arj
I am developing a page in which i want to show total number accounts who have certain condition, my code is like this:
Even though i have put everything in try and catch block i still get the following error:
System.Exception: Too many query rows: 10001
it seems as a developer i do not have the right to choose the fate of my App!
SOQL count() and Too many query rows: 10001!
I am developing a page in which i want to show total number accounts who have certain condition, my code is like this:
Code:
if (ptotalRecords == 0) { try { ptotalRecords = [select count() from Account WHERE (Hierarchy_Status__c = 0 OR Hierarchy_Status__c = null) AND (parent_duns_number__c != null OR Ultimate_Parent_D_B_Number__c != null)]; } catch(Exception ex) { ptotalRecords = -1; } } if (ptotalRecords == -1) return '10,000+'; else return ptotalRecords+ '';
Even though i have put everything in try and catch block i still get the following error:
System.Exception: Too many query rows: 10001
it seems as a developer i do not have the right to choose the fate of my App!
In that case how would I know if there were only 10,000 records or more?
Sam.arj wrote:
System.Exception: Too many query rows: 10001
it seems as a developer i do not have the right to choose the fate of my App!
I'm afraid as a consumer of the platform once you trigger a governor exception you do not have the ability to catch and perform additional processing. You have touched on a somewhat sore point where the count() operation is being treated as the number of line items not the single summation returned for the SOQL query limit. It has been raised on the ideas page and please vote for this behavior to be changed - http://ideas.salesforce.com/article/show/10089055
Message Edited by Box on 07-31-2008 09:27 AM
So, with the release of the new COUNT(Id) aggregate function, do you think we'll still be limited to a maximum count of 10,000 (due to the fact that the Governor considers COUNT the same as SELECT)??
Seems crazy that we can't actually tell how many records exist for a particular SOQL query!
I have an Object with 80 million Records. I have other objects with a couple million. I can run a report and a dashboard on the Objects under 4 million, but I can't get any reports to run on the Object with 80 million records. When I try to select count() from Object, I get timeout.
There needs to be functionality to count records with either SOQL or reports/dashboards. It's the only way to automate operational reports.
Any Idea if/when count(Id) will be available, and will it be able to count 80 million records?
Thanks. Regards,
Tom