Re: [sqlite] Help with slow queries

2013-02-06 Thread Simon Slavin
On 6 Feb 2013, at 5:53pm, Jamie Norrish wrote: > On Tue, 2013-02-05 at 22:59 +, Simon Slavin wrote: > >>>(SELECT tn.ngram >>> FROM TextNGram tn, Text t >>> WHERE t.label != Text.label >>> AND t.label != '' >>> AND tn.text = t.id >>>

Re: [sqlite] Help with slow queries

2013-02-06 Thread Jamie Norrish
On Tue, 2013-02-05 at 22:59 +, Simon Slavin wrote: > This might be faster if you have an index for TextNGram(text, size, > ngram). Thanks, I'll definitely try that! > > (SELECT tn.ngram > >FROM TextNGram tn, Text t > >WHERE t.label != Text.label > >

Re: [sqlite] Help with slow queries

2013-02-05 Thread Simon Slavin
On 5 Feb 2013, at 10:27pm, Jamie Norrish 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).

[sqlite] Help with slow queries

2013-02-05 Thread Jamie Norrish
I would appreciate any help with improving the query times I'm experiencing. The database is composed of n-grams drawn from a set of texts, which are dynamically labelled (some with no label, which are not counted) and differences and intersections are found between the n-grams of each labelled set