I solved my "inner/outer" problems by compiling Sqlite with 
SQLITE_ENABLE_STAT2=1.

That flag makes it better at choosing the inner table!
 
> To: sqlite-users@sqlite.org
> From: itandet...@mvps.org
> Date: Wed, 11 Nov 2009 12:03:06 -0500
> Subject: Re: [sqlite] optimization question
> 
> 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
                                          
_________________________________________________________________
Hitta hetaste singlarna på MSN Dejting!
http://dejting.se.msn.com/channel/index.aspx?trackingid=1002952
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to