On 5 Feb 2013, at 10:27pm, Jamie Norrish <ja...@artefact.org.nz> wrote:
> WHERE Text.label IN (%s) > AND TextNGram.size BETWEEN ? AND ? > AND TextNGram.text = Text.id > ... > ORDER BY TextNGram.size, TextNGram.ngram This might be faster if you have an index for TextNGram(text, size, ngram). This might replace the existing index TextNGramIndexSize you have. > (SELECT tn.ngram > FROM TextNGram tn, Text t > WHERE t.label != Text.label > AND t.label != '' > AND tn.text = t.id > AND tn.ngram = TextNGram.ngram Is the last line not a test to see that "Text.label != Text.label" and "TextNGram.ngram = TextNGram.ngram" ? The whole thing might work faster if you first load a representative dataset into all tables, then run the ANALYZE command. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users