Re: foreign key on delete cascade order?

From: George Woodring <george(dot)woodring(at)iglass(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: foreign key on delete cascade order?
Date: 2022-03-10 17:32:21
Message-ID: CACi+J=T4C9CRs00=NZhSxpsNhQ+cKgFZHJ2U_Mjrd6p_HDUxzg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Mar 10, 2022 at 10:56 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Each cascaded delete ought to be removing a disjoint set of rows in the
> referencing

table, so I'm not quite sure why order should matter.
>
> regards, tom lane
>

I have always thought the way to avoid deadlocks was to update rows in the
same order by the different updaters. Is there a better chain of thought
for updating and deleting rows at the same time? Do we need to put a lock
on the table to update, then have the delete queue up waiting for the lock
to be removed?

Thanks,
George

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2022-03-10 17:38:27 Re: foreign key on delete cascade order?
Previous Message Peter Juhasz 2022-03-10 16:18:06 [pgpool] invalid read kind