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

Too many queries rows 500001
Hi,
How to avoid Too many queries rows 500001 in the apex class.
I have one query
As per requirement i dont need to use where condition in the above query .............
Any suggestions,
Regards,
VSK
How to avoid Too many queries rows 500001 in the apex class.
I have one query
list<Account> acc = [select id,Fax from Account];
As per requirement i dont need to use where condition in the above query .............
Any suggestions,
Regards,
VSK
Is there any alternative ?
Hi VSK98,
You should use LIMIT to control the governor limit of 50000 records.
Use below syntax:
I would like to use all my account records & do sum action on it.
Regards,
VSK
However, with Batch Apex your logic will be processed in chunks of anywhere from 1 to 200 records in a batch.
You'd need to modify your business logic to take the batching into account if necessary.
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_batch_interface.htm
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_SOQL_agg_fns.htm
(1) Batch apex
(2) Readonly mode
If the code is used in a readonly report, then please consider to add the Readonly annotation in the code.
Here is an example:
Visualforce page
Alex Class
For more information, please find it in the link:
https://developer.salesforce.com/docs/atlas.en-us.200.0.pages.meta/pages/pages_controller_readonly_context_pagelevel.htm
BTW, aggregate SOQL does not skip away the query row limitation.