On 9 Sep 2013, at 4:35pm, Mohit Sindhwani <m...@onghu.com> wrote: > I just added indexes as best I saw: > * an index on TI(itemid) -- this was already there > * an index on TI(itemid, day) -- I just added this > * an index on WD(day, wday) -- I just added this > * an index on WD(wday) -- I just added this > [WD(day) is actually the primary key on that table] > > It still doesn't solve it - still out of memory. > > This is the query plan: > 0|0|0|SCAN TABLE itemdata AS TI (~1000000 rows) > 0|1|1|SEARCH TABLE weekdays AS WD USING INTEGER PRIMARY KEY (rowid=?) (~1 > rows) > 0|0|0|USE TEMP B-TREE FOR GROUP BY
I do not think this will solve your problem in one go, but execute the SQL command ANALYZE then try it again. If it doesn't help, please post the new query plan. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users