Which action can a developer take to reduce the execution time of the - ProProfs Discuss
Advertisement

Which action can a developer take to reduce the execution time of the following code?

List<account> allaccounts = [select ID from account];list<account> allcontacts = [select ID, accountid from contact];for (account a :allaccounts){ for (contact c:allcontacts){   if(c.accountid = a.ID){do work } }}

Asked by Marcofrancesconuzzo, Last updated: Nov 25, 2020

+ Answer
Request
Question menu
Vote up 1 Vote down

2 Answers

shilpaads09

shilpaads

shilpaads09
Shilpaads

Answered Nov 08, 2019

A. Use a map for all accounts
upvote downvote
Reply 

marcofrancesconuzzo

marcofrancesconuzzo

marcofrancesconuzzo
Marcofrancesconuzzo

Answered Jul 28, 2019

Use a map for allaccounts
upvote downvote
Reply 

Advertisement
Advertisement
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader

Email Sent
We have sent an email to your address "" with instructions to reset your password.