... of a second even if 100 patients are returned. The problem is not that the code is inefficient per se, it's just that 1. more data has to be transmitted / received, and 2. that is done piecemeal rather than in aggregate. So you could use an SQL based data base back end. Your code might look ...