"Simon Slavin" wrote...

On 16 Jul 2014, at 3:21am, jose isaias cabrera <cabr...@wrc.xerox.com> wrote:

SELECT * from startcodes where code = 'e';

but I want to search only from id >= 8 and <= 14. Is there a way to set the boundary for that SELECT that will only search ids 8-14? I know I can do a WHERE id BETWEEN 8 AND 14, but is there another faster way?

That way is not particularly slow. You just need to have a good index. A good index for that search would be

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. Thanks for your help.

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

Reply via email to