In my Android project, I have a SQLite table data containing two rows, id and name. It has +/- ten records. Note that records may have been deleted, so the ids could be non-sequential.
In an activity I need the corresponding names of +/- 100 ids (obviously with lots of duplicate values).
I could do this by executing the SQLite query SELECT name FROM data WHERE id = x a hundred times.
Another option is executing the SQLite query SELECT id,name FROM data one time, then store the ids and the names in an array, and then get the names of the ids by java (String name = namesArray[Arrays.binarySearch(idsArray, x)];
Which method should I use? Or is there even a better solution?
The second option is much faster.