Deleting orphaned records (not exists is very slow)

From: Tim Uckun <timuckun(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Deleting orphaned records (not exists is very slow)
Date: 2010-09-27 12:02:14
Message-ID: AANLkTikEksN_eWqgS1+A9bzT6Duazy2KA1RztwGy1aid@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

What is the best strategy for deleting orphaned records from a large table.

The usual NOT IN is very slow so there must be a better way in
postgres for dealing with these.

I know it's best not to have the orphans in the first place but in
this case it happened and I need to clean up before I can put in some
referential integrity.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message yj2133011 2010-09-27 12:14:51 Re: pg_filedump binary for CentOS
Previous Message Devrim GÜNDÜZ 2010-09-27 11:47:15 Re: pg_filedump binary for CentOS