+ Start a Discussion
surasura 

Salesforce Inline queries are very Slow

Hi guys , 
currently i am working on a performance improvement of salesforce Application.In that process one of my colleagus found an a post that said inline queries are much slower than the tradional queries https://www.youtube.com/watch?t=317&v=-edHmVGMkU0 (https://www.youtube.com/watch?t=317&v=-edHmVGMkU0) and we checked out and it seems to be true .some times to the extent of 5 times slower than tradional way. Since Salesforce recommend inline queries as a best practice this is really baffling.

only difference is inline quereis seems to consume much less heap 
eg:
 
for(Contact con :[Select Id,Name From Contact])
{

   system.debug('1111111111');

}

is much slower than 
List<Contact> con = [Select Id,Name From Contact];
for(integer i =0 ;i< con.size();i++)
{
    
    system.debug('1111111111');
    
}


 
AbdelhakimAbdelhakim
it's true