Dealing with a Large Local Database


I’m working on an app that typically has 500k records, all local. I’d like to present a fluid UX.

Imagine it looks like iTunes except with 500k songs. You can show songs but you can also search, search should be live as in type “B” and everything that has a B in it shows up while typing (Bengals, Beatles, B-52s.) “Be” shows (Beatles and Bengals), “Bea” just Beatles. My impression is with 10k records or less I could do this in the main thread but with 500k records it’s a not so easy.

Are there known techniques to deal with this? Do I put the DB in a worker and have some kind of reactive cursor to only show part of the data? I’m not looking for code, just tips or pointers.