Let's say I have 10 customers that I need to select from my SQL database. I'm using a join in my select statement and the tables are pretty big. I have some processing to be done for each customer after it's been selected. I'd like to know what would be better in terms of performance (speed):
a) have one select statement listing all the customers in the where clause
OR
b) do a select statement for each customer.
I'm trying to do b) so that I don't have to use looping through an array list too many times (I would have to maintain three array lists because of the processing that I have to do for each customer), which could potentially slow down the program if I had much more than 10 customers, but wouldn't it still be faster than executing a select stm for each customer?
Thank you for your opinion.
a) have one select statement listing all the customers in the where clause
OR
b) do a select statement for each customer.
I'm trying to do b) so that I don't have to use looping through an array list too many times (I would have to maintain three array lists because of the processing that I have to do for each customer), which could potentially slow down the program if I had much more than 10 customers, but wouldn't it still be faster than executing a select stm for each customer?
Thank you for your opinion.