Thank you, Igor. Processing time: 5 seconds.  :-)

Igor Tandetnik wrote:
> Tim Romano <tim.rom...@yahoo.com> wrote:
>   
>> I've read http://www.sqlite.org/optoverview.html but don't find my
>> answer there.
>>
>> In the following query, WOIDS has 4 million rows and CORNFIX has
>> 25,000 rows.
>>
>> UPDATE    WOIDS
>> SET              corn = 1
>> WHERE     EXISTS
>> (
>> SELECT     *
>>  FROM          CORNFIX
>>  WHERE      (cornfix.col_1 = woids.ttl) AND (cornfix.col_2 =
>> woids.pos) AND (cornfix.col_3 = woids.wrdid)
>> )
>>     
>
> Try this instead:
>
> update WOIDS set corn=1 where rowid in
> (select w2.rowid
>  from cornfix join woids w2 on (
>     cornfix.col_1 = w2.ttl AND cornfix.col_2 = w2.pos AND cornfix.col_3 = 
> w2.wrdid)
> );
>
> I'm not sure, but this structure might help SQLite choose cornfix for the 
> outer loop.
>
> Igor Tandetnik
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> ------------------------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com 
> Version: 8.5.425 / Virus Database: 270.14.60/2496 - Release Date: 11/11/09 
> 07:40:00
>
>   

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

Reply via email to