Delete in Loop

Hi guys, I have a question about a Delete behaviour in a Loop. I can choose between two options: I delete the object from the database right after the REST-call was successful. After the REST-call was successful I add the object, I want to remove from the database, in a list with objects to delete and after the loop I will delete/empty this list.  Which of the above options is better for the performance of the application?  Thanks in advance.
1 answers

Hi Joyce,


Second option is better for performance.  Because in second case, you have to hit the DB only one time whereas in first case you will hit the DB more than 1 time