function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
DowithforceDowithforce 

How to handle query records more than 100000 in apex?

Hi all,

 

 

Here once again posting.

 

In API say PHP salesforce API we can handle huge data with querymore, querylocator. I have implemented. 

 

In Apex I have implemented standardsetController, paging. it is working fine for records upto 10000. I know its LIMIT and WELL KNOW ISSUE (as everyone taking about this ONLY).

 

I know there are more than 100000 records will return by query, I have to fetch and display with pagination. My concern is fetch and display.

 

 

 

 

Q. How to handle query records more than 100000 in apex?

 

Can anyone please answer this question so I can implement it?

 

 

Thanks 

 

Message Edited by Dowithforce on 10-29-2009 02:27 AM
Message Edited by Dowithforce on 10-29-2009 02:43 AM
Message Edited by Dowithforce on 10-29-2009 02:44 AM
paul-lmipaul-lmi
you have multi-currency enabled for your live and sandbox orgs, but not dev. this isn't enabled by default, so you'd need to contact support to do so.
waylonatcimwaylonatcim
Check out this page on working with large data sets in apex:
http://www.salesforce.com/us/developer/docs/apexcode/Content/langCon_apex_SOQL_VLSQ.htm
DowithforceDowithforce

Thanks for reply!

 

SOQL for loop is of that type but I don't want to do update, insert and delete operation (DML) though Ican I used it? please explain.

 

Thanks

Message Edited by Dowithforce on 10-29-2009 01:01 PM
Anand@SAASAnand@SAAS
I'm interested in your use case of why you are trying to fetch 100,000 records. This is usually not a good practice for web applications in general and more specifically for force.com apps due to the governor limits that are enforced.
DowithforceDowithforce

Thanks for interest.

 

Let me clear the topic. I have to fetch leads but it is goining beyond gov. limits.

 

I have fine with 1000 records per query call paging with the setcontroller. But looking in to setcontroller

 

and 1000 records fetching query for each next button click. Any thought? 

KVaishnaKVaishna

Does this really work?

I tried and got following error where my query tries to fetch 0.1 Million records and update a field based on some condition.

 

System.Exception: Too many query rows: 501

DowithforceDowithforce

for setcontroller it work for 10000 records.

 

 

Thanks, 

SidMSidM

I have a solid use case for wanting to COUNT more than 100,000. We need to know the total 'population' in order to correctly calculate the statistical sample size of records the user needs to select as part of an audit sample.

 

Because Salesforce considers COUNT and SELECT to be the same in term of resource usage, we're in quite a bit of trouble.

 

I'm also suprised (dissappointed) that, with the release of their new COUNT(Id) function in Spring 10, Salesforce haven't taken the opportunity to sort out the issue.