Hi,

of course there is in general a difference between syntax complexity and 
performance but unfortunately not in this case. And the „just“ is very often 
the most difficult part.

Regards,
Hartwig

> Am 2016-06-07 um 07:39 schrieb James K. Lowden <jklow...@schemamania.org>:
> 
> 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
> 

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to