Is reading from the db in one transaction premature optimization

You want to get the data of the items from the db using the ids. You have a stored procedure that takes an id and gives you a single row with the data.

  1. Call query to get ids.

  2. Loop each id and call the stored procedure given an id.

Would writing a new stored procedure to do this in one transaction be considered premature optimization?