On 31 Jan 2013, at 8:48pm, Paul Sanderson <sandersonforens...@gmail.com> wrote:

> Thanks all
> 
> All columns in the query are indexed.

That does not do you much good.  Each SELECT can use only one index at a time.  
So if you have one index per column the query uses an index on, say, isgraphic, 
then it will have to search every value in vsc itself.

The way to create indexes is to figure out one index that's useful for each 
SELECT.  Here's the command you want to speed up:

> My query is
> 
> select fileref from rtable as r where vsc > 0 and isgraphic = 1 and not
> exists (select md5 fr
> om rtable as r1 where r.md5 = r1.md5 and isgraphic = 1 and vsc = 0);

Depending on how chunky the values are in each column, a good index for this 
would be an index on (md5,isgraphic,vsc).  Try creating this index and see if 
it helps.

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

Reply via email to