+ Start a Discussion

Regarding Governer Limits for List and SOQL...

Hi everyone,

As we know that, SOQL can fetch a max of 50,000 records in a single execution...and
a List can store upto 1000 records...

List<Account> lst_acc = new List<Account>([Select id, name from Account]);

If the SOQL gives me more than 1000 records, how can I store them to the List.
HI Vempally,

List wil not store 1000 record .If you want to dislay in vf without paginnation then you 1000  limit will come .else you can store more then 50000 record in a list .List has a limit of Heap size which is 6 mb .
You can check list create two list of account like accList /accList1 and Query with LIMIT 50000 .Now add both query it will add unless it wil reach the heap limit .
Let me know if it helps !!
Vasani ParthVasani Parth
I'd a similar thought earlier and a requirement as well. Please have a look at this blog (http://kuldeeptyagi.blogspot.in/) . 

Please mark this as the best answer if this helps.