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
itdeptitdept 

number of query rows governor limit warning...

Received the following error in an email when I was just playing with some code in the developer console.


Apex governor limit warning email below:

----------------------------------------------------------------------------------------------

Operation: execute_anonymous_apex.Lead

By user/organization: 005A0000000ZeAg/00DA0000000JRJD

Caused the following Apex resource warnings:

Number of query rows: 35081 out of 50000

(these emails can be disabled from the user detail page for this user)

----------------------------------------------------------------------------------------------

 

My code was simply this:

 

for(Lead[] myleads : [select id, FirstName FROM Lead])
{

    system.debug(myleads.size());
}

 

My question:

If I have more than 50K rows in the Lead table, how would one be able to query the records in this table to effectively access all the records?  I don't yet have a use case, but I'd imagine that someone would need to query all records of a table for some process, and how to go about it when the records in the table exceeds that of the governor limit.

 

Thanks,

Frank

Best Answer chosen by Admin (Salesforce Developers) 
@anilbathula@@anilbathula@

All Answers

@anilbathula@@anilbathula@
This was selected as the best answer
itdeptitdept

@anilbathula@,

 

Thanks so much!  Simple, Sweet, and Awesome!