How would you approach when implementing search functionality for a data that is stored in local database?
Prefetch whole list from database and then perform filtering on that cached list (have to created a backup variable), when user types
Make database query every time user types
There are 200-300 rows in the table. Each row contains 10-15 columns.
PS: I always used to perform filtering on a cached list, mostly because I was required to show full list anyway, so the whole data set was already prefetched.
Let's assume you don't have to show the whole list in the first place and only show when user start typing, is it better overall to perform database query in this case?
I'm just not sure. I saw a colleague doing query.
And yeah I'm too lazy to test performance of db querying. Visually there is almost no lag though.
Every opinion is welcome!
Thanks!