Igor Tandetnik wrote: > On 9/5/2012 12:38 PM, E. Timothy Uy wrote: >> I have a column in table 'alpha' which I would like to populate with data >> from table 'beta'. As far as I know, we cannot do an UPDATE using JOIN in >> sqlite, but we can >> >> UPDATE alpha SET frequency = (SELECT frequency FROM beta WHERE >> beta.term = >>> alpha.term) >> >> 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. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users