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
sampathawaduge sameerasampathawaduge sameera 

What is the advantage of querying within loop?

what is the advantages of querying data withing the for loop itself like below

for(Account a:[select name from Account])
{
***logic***
}
Best Answer chosen by sampathawaduge sameera

All Answers

Raj VakatiRaj Vakati
It's going to reduce the heap size. Its one of the technique to reduce the heap size 
<Saket><Saket>
Raj V awesome 👌
sfdcMonkey.comsfdcMonkey.com
This was selected as the best answer