On 6 Sep 2012, at 2:53am, Yuriy Kaminskiy <yum...@gmail.com> wrote: > Igor Tandetnik wrote: >> On 9/5/2012 12:38 PM, E. Timothy Uy wrote: >>> Will the database really be doing a select in beta for >>> every single line in alpha? >> >> Yes - same as when implementing a join. How do you think a join is >> performed - black magic? > > Subquery: O(n*log(m)), join: O(n+m). Magic! > Of course, query optimizer sometimes can rewrite subquery as join (or > opposite), > but I believe (unverified!) sqlite optimizer cannot do this currently.
You can all take a look at everything mentioning JOIN in http://www.sqlite.org/optoverview.html and at what EXPLAIN and EXPLAIN QUERY PLAN return. JOINs are actually processed as something which resembles sub-selects. The two constructions are more or less equivalent and there's no great speed difference between them. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users