Re: Problem Deleting Referenced records - Mailing list pgsql-general

From Bruno Wolff III
Subject Re: Problem Deleting Referenced records
Date
Msg-id 20031110145117.GA23136@wolff.to
Whole thread Raw
In response to Re: Problem Deleting Referenced records  (Alex <alex@meerkatsoft.com>)
Responses Re: Problem Deleting Referenced records  (Alex <alex@meerkatsoft.com>)
List pgsql-general
On Mon, Nov 10, 2003 at 16:20:21 +0900,
  Alex <alex@meerkatsoft.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.

pgsql-general by date:

Previous
From: "Philippe Lang"
Date:
Subject: Dynamic expression evaluation
Next
From: Tom Lane
Date:
Subject: Re: Dynamic expression evaluation