* Sankar P.:
SELECT DISTINCT column2 FROM autocomplete WHERE column1 LIKE '<prefix>%' ORDER BY column3 DESC LIMIT 5
where column1 and column2 are strings and column3 is int.
So, what my query essentially does is get a prefix string from user and get the top (sorted by column3) 5 records where column1 start with the input prefix and return the column2 of those records.
In my sqlite, the first time query for each key (a or b or c ...) is taking about 350 seconds (with an index on all columns) and about 500 seconds (with an index on only column1).
Do you use PRAGMA case_sensitive_like? How many candidate does the "column1 LIKE '<prefix>%'" expression select?