In my schema, there is a master data table that holds some "commonly used
rows" ("commonly used" in the sense of e. g. ZIP codes beeing commonly
used).

Several tables reference that master data table using foreign keys to
prevent deletion of the "common date" while still referenced.

Now I want to write a SQL statement that deletes all "commonly used rows" no
more referenced by any row.

So currently I am doing:

DELETE FROM CommonStuff WHERE id NOT = ANY (SELECT id FROM ReferencingTableA
UNION SELECT id FROM ReferencingTableB)

Certainly that is rather slow since it does a complete scan of all
ReferencingTables AND the CommonStuff table.

Is there any way to get to the same result with a more sophisticated SQL?

It's a pity that there is nothing like a "ANTI-INNER-JOIN" resulting in
short SQL statements and selecting those rows NOT selecting when doing INNER
join; one could write "DELETE FROM CommonStuff ANTIJOIN ReferencingTableA
ANTIJOIN ReferencingTableB. ;-)

Thanks!
Markus