Hi Daniel,
> Now I wanted to delete about 10 million addresses (that are not
> referenced anymore from anywhere), and have a statement like:
What about:
DELETE FROM address
WHERE id IN (
SELECT id FROM address
EXCEPT
(
SELECT address_id FROM tab1
UNION ALL
SELECT address_id FROM tab2
UNION ALL
...
)
)
?
You could also easily restrict that query to multiple ranges of
adress.ids to control memory usage and transaction duration.
-hannes