What version of SQLite and what indexes have you created? (and, if you have relevant indexes, have you run analyze?)
>-----Original Message----- >From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users- >boun...@sqlite.org] On Behalf Of E. Timothy Uy >Sent: Thursday, 30 January, 2014 09:25 >To: General Discussion of SQLite Database >Subject: [sqlite] order of = in join > >#1 - f.term = t.term >SELECT m.term AS term, m.definition AS definition >FROM >(SELECT t.term, e.definition >FROM Terms_content t >INNER JOIN Favorites f ON f.term = t.term >LEFT JOIN TermEntries te ON te.termid = t.docid >LEFT JOIN Entries e ON e.docid = te.entryid) AS m >LEFT JOIN Favorites f ON f.term = m.term" > >#2 - t.term = f.term >SELECT m.term AS term, m.definition AS definition >FROM >(SELECT t.term, e.definition >FROM Terms_content t >INNER JOIN Favorites f ON t.term = f.term >LEFT JOIN TermEntries te ON te.termid = t.docid >LEFT JOIN Entries e ON e.docid = te.entryid) AS m >LEFT JOIN Favorites f ON f.term = m.term > > >Here the Terms_content table is big, maybe 300k rows, while the Favorites >table is small, <100 rows. Query #1 takes 300 ms, and query #2 takes 30 >ms. >_______________________________________________ >sqlite-users mailing list >sqlite-users@sqlite.org >http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users