If you don't need the data for more then a transaction, or connection length - use temporary tables to store ids of data you need to delete. If those change, or move, or something - it means you are missing PK on that table.
pgsql-general by date:
Соглашаюсь с условиями обработки персональных данных