Thomas Kellerer <spam_ea...@gmx.net> writes: > Lately I had some queries of the form:
> select t.* > from some_table t > where t.id not in (select some_id from some_other_table); > I could improve the performance of them drastically by changing the NOT NULL > into an outer join: > select t.* > from some_table t > left join some_other_table ot on ot.id = t.id > where ot.id is null; If you're using a reasonably recent version of PG, replacing the NOT IN by a NOT EXISTS test should also help. > Now I was wondering if a DELETE statement could be rewritten with the same > "strategy": Not at the moment. There have been discussions of allowing the same table name to be respecified in USING, but there are complications. regards, tom lane -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql