On 16 Jul 2014, at 1:23pm, jose isaias cabrera <cabr...@wrc.xerox.com> wrote:

> "Simon Slavin" wrote...
> 
>> CREATE INDEX sci ON startcodes (code,id)
>> 
>> You will find that that SELECT will then be blisteringly fast even with 
>> millions of rows in your table.
> 
> I do have that INDEX for that id and table.  Thanks. :-)  I was just trying 
> to be greedy and see if I could become even faster.

Executing ANALYZE (just once: the results are saved in the database) might help 
SQLite pick the best index.  However, if you have that index I'd be stunned if 
you have any real problem with the speed of SQLite, unless you are hampering it 
in some way, perhaps with badly chosen PRAGMAs.

To answer your original question, having that index and putting both terms in 
your WHERE clause is the recognised way of making SQL do the search you want.  
From there it's up to SQL to do its job quickly and it shouldn't be your 
problem.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to