Thank you, Simon! Could you please say me what indexes will be correct?
I'm trying
CREATE INDEX mgwrInd1 ON mgWordsRelations (id_norm)
CREATE INDEX mgwrInd2 ON mgWordsRelations (id_norminrel)
CREATE INDEX wfInd1 ON wform (wordForm)
CREATE INDEX wfInd2 ON wform (wordNorm)
CREATE INDEX wfInd3 ON wform (ancode)
but I have really high lack of perfomance. What is wrong with it? If you
couldn't answer maybe you could post me some link to read about it? Thank
you.


Simon Slavin-3 wrote:
> 
> 
> On 15 Nov 2009, at 12:08am, Igor Tandetnik wrote:
> 
>> select wf1.wordForm
>> from wform wf1 join mgWordsRelations rel on (wf1.wordNorm =
>> rel.id_norminrel)
>>    join wform wf2 on (rel.id_norm = wf2.wordNorm)
>> where wf1.ancode = 'someAncode' and wf2.wordForm = 'someWord'
>> order by random() limit 1;
>> 
>> It's the same query, just written in a simpler form that might make it
>> easier for SQLite to optimize.
> 
> Also, we assume that you have all the best indexes to make the JOINs and
> WHEREs work quickly.
> 
> Simon.
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Help-me-please-to-optimize-sql-query-tp26354687p26358412.html
Sent from the SQLite mailing list archive at Nabble.com.

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

Reply via email to