Indexes and like do not work in most databases. It is best to rewrite the query as a range query, if possible, because then the index will be used:
select * from wordIndex where word between 'test acces' and 'test acces{'
(The open brace is an ASCII character immediately after "z".)
If you are looking for patterns at the beginning of a word (for example, "% test"), you may need to surrender yourself in a full table scan.
EDIT:
Indexes and like * do` go today in most databases when templates start with a constant, so you can do:
select * from wordIndex where word like 'test acces%' ;
I'm not 100% sure about SQLite, so check your execution plan to see if it uses an index.
Gordon linoff
source share