On Sat, 4 Jun 2016 18:18:36 +0200 skywind mailing lists <mailingli...@skywind.eu> wrote:
> At the moment I have to run something like: > > UPDATE A SET item1=(SELECT B.item FROM B WHERE B.ID=A.ID),... > itemN=... WHERE EXISTS (SELECT 1 FROM B WHERE B.ID=A.ID); > > Using a FROM clause I just need one scan through B (at least in > principle). Now, I need N+1 scans. Nonsense. SQL provides no instruction to the implementation on how to organize or traverse the data. SQLite is free to scan B once, twice, or not at all. Syntax has nothing to do with performance. A correlated subquery is an expression of logic; it's not meant to be taken literally, and often isn't. This particular form "just" needs to be recognized by the optimizer. --jkl _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users