Re: Performance problem with DELETE FROM/correlated subqueries

Clemens Ladisch <clemens-P6GI/[email protected]>
Newsgroups gmane.comp.db.sqlite.general
Message-ID <[email protected]>
Jürgen Baier wrote:
>   CREATE TABLE main ( ATT1 INT, ATT2 INT, PRIMARY KEY (ATT1,ATT2) );
>   CREATE TABLE staging ( ATT1 INT, ATT2 INT );
>
> Then I execute
>
>   DELETE FROM main WHERE EXISTS (SELECT 1 FROM staging WHERE main.att1 = staging.att1 AND main.att2 = staging.att2)
>
> which takes a very long time.

DELETE FROM main WHERE (att1, att2) IN (SELECT att1, att2 FROM staging);


Regards,
Clemens
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.