I wanted auto completion feature in ipad app. I have a sqlite database of words. On typing letters in a search box i load the keywords in a UItableview. I have used the following select query,
SELECT word from tbl_words where words like a%
When i had few hundred words, every thing worked fine. But when my database grown to have thousands of words, the response is slow. So i made auto completion active only after typing 3 letters. Which gave few number of words yet it is slow.
I looked into sqlite optimization techniques in this SQLite_optimization_FAQ. It suggests to avoid like % to make use of indexing.
I know that i can create index for column using
CREATE INDEX tbl_words ON mytest(words);
Is there anything else i can do to improve performance?. Any help would be appreciated
Instead of hitting the database everytime, load the all values into an array and search the array. This will improve the performance.