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
CustomDataIntegrationsCustomDataIntegrations 

Too many query rows 50001

The 2nd line below errors with the "Too many query rows 50001".  Is that because 50000 may have already been hit with the first query?    
 
List<Contact> lstContacts = [select id, MailingStreet, MailingCity, MailingState, MailingPostalCode, FirstName, LastName from contact LIMIT 50000];
        List<Lead> lstLeads = [select id, Street, City, State, PostalCode, FirstName, LastName from lead LIMIT 50000];
        List<Account> lstAccounts = [select id, ShippingStreet, ShippingCity, ShippingState, ShippingPostalCode from account LIMIT 50000];
pconpcon
Yes, the governor limits apply to the entire transaction.  If you need to iterate over more than 50,000 records, I would recommend using the Batchable context [1].  With that you can access up to 50 million records, but you will have to operate in an asyncronous context.

[1] http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_batch_interface.htm