You need to sign in to do that
Don't have an account?

Count of more than 50,000 Records
Hi,
I need to count the TOTAL Record of Account Object using SOQL and display the record count in the Visualforce page, I am already having more than 50,000 records. How can I get the record count and display the total record count in VF Page? Is there is any other way to get the count in Vf page?
Thanks,
Arunraj
Integer ab = [Select count() from Account ];
Use this integer in VF Page .
Cheers
Bramha
Dam!! How can i missed that,
Here is the code :
Thanks
Ankit Arora
Blog | Facebook | Blog Page
I am getting the following error "System.LimitException: Too many query rows: 50001?" , when the record count is more than 50000, so what i need to do to get the exact record count in VF Page(When it is more than 50,000).
Thanks,
Arunraj
Unfortunately, the aggregate functions are still crippled by the standard SOQL query limits on the number of records retrieved. Even though you are really only bringing back one "row" of data, you are still dinged for every record that makes up that count.
See the note on this page of the Apex docs.
http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#StartTopic=Content/langCon_apex_SOQL_agg_fns.htm?SearchType=Stem
Hi,
I am also getting the same error.
I would like to count number of records over 50k but i am getting "System.LimitException: Too many query rows: 50001".
Can any one provide some suggestion to count number of records
Regards
Sonu Sharma
If you only want to display the count, thne you can use @Readonly annotation.