mercredi 14 janvier 2015

Optimize sqllite search

I have a database with contact data from around 250.000 people.


This is what I do, to search a name. The search should include first and lastname and the searchstring should be at the beginning of the first or lastname:



SELECT contacts.firstName, contacts.lastName
FROM contacts
WHERE (contacts.lastName LIKE '" + searchstring + "%') OR (contacts.firstName LIKE '" + searchstring + "%')"
ORDER BY lastName, firstName";


This brings up the required results, but a searchs duration is around 5 secs which is way to much. I think there is a lot of potential to optimize this search. Do you have any sources or tips for me?


Aucun commentaire:

Enregistrer un commentaire