Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Performance Question

I have a question regarding the performance of SQL. I will illustrate my problem with pseudocode.

I am wondering which will preform better and by how much? Say for 10 items, on each page load. In .NET. Is is a lot faster? a little faster? A difference not noticable on SQL?

foreach(item in mylist) {
CallSQLStoredProc(item.id);
}

vs

int[] ids; // array of ids
CallSQLStoredProc(ids)  // stored procedure returns more than one row for each id
like image 534
Oliver S Avatar asked Dec 09 '22 22:12

Oliver S


1 Answers

The second option will certainly be faster because it is a single network round trip, as well as a single SP call.

like image 142
Otávio Décio Avatar answered Dec 13 '22 14:12

Otávio Décio