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
EIE50EIE50 

Basic governor limit workaround

Hi,

 

I have a situation where i have to list out all the records in one page. I can write a query for this, but there are few thousands of records around 40k+, so how do i get around the governor limit in this case?

 

This is my sample code :

 

List<Idea> abc = [select DomId from Idea];
System.debug('#############'+abc.size());

 Here is the debug log :

 

Number of SOQL queries: 1 out of 100
Number of query rows: 43509 out of 50000

 Can anyone lead me with a code snippet to get around the governors.

 

Thanks.

Best Answer chosen by Admin (Salesforce Developers) 
BritishBoyinDCBritishBoyinDC

You can't by pass the limits, but if you don't need to update the records you're returning, set the page to ReadOnly (it's a new feature in Winter 12)

All Answers

BritishBoyinDCBritishBoyinDC

You can't by pass the limits, but if you don't need to update the records you're returning, set the page to ReadOnly (it's a new feature in Winter 12)

This was selected as the best answer
EIE50EIE50

Hi,

 

Should i use @readonly annotation in my apex class and set my vf page attribute to read only, or only in apex class or only in Vf page?

BritishBoyinDCBritishBoyinDC

Just set it on the page, and it will let the Apex controller called by that page bring back up to 1m rows...

EIE50EIE50

Thanks, i got it.

jojoforcejojoforce

How do you set the page to readonly or @readonly?

BritishBoyinDCBritishBoyinDC

On the page tag:

 

<apex:page readOnly="TRUE">