Re: Problem Deleting Referenced records

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Alex <alex(at)meerkatsoft(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Problem Deleting Referenced records
Date: 2003-11-10 14:51:17
Message-ID: 20031110145117.GA23136@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Nov 10, 2003 at 16:20:21 +0900,
Alex <alex(at)meerkatsoft(dot)com> wrote:
> Bruno,
> thanks. I actually did it that way but having to join two tables each
> 1-2 million records makes this process rather time consuming.
> I was hoping that the ON DELETE options in the constraint could handle
> that.

If only a small number of the 1-2 million records have old dates, than the
where not exists method might be faster. An index scan could be used
to find the records with old dates and then for each record an index
lookup could be done in table B to see if it should really be deleted.

>
> It seems to be a bit odd that if I want to delete 100 records that are
> not related to each other, and one record deletion fails that then the
> entire delete process fails.

You can delete each record in its own transaction if you want that
behavior.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message My Deja 2003-11-10 14:52:42 Re: Internet based database
Previous Message Philippe Lang 2003-11-10 14:41:07 Dynamic expression evaluation