Reducing likelihood of deadlocks (was referential Integrity and SHARE locks)

From: Marc Munro <marc(at)bloodnok(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Reducing likelihood of deadlocks (was referential Integrity and SHARE locks)
Date: 2007-02-08 16:47:42
Message-ID: 1170953262.21038.28.camel@bloodnok.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I am going to restate my earlier proposal, to clarify it and in the hope
of stimulating more discussion.

One of the causes of deadlocks in Postgres is that its referential
integrity triggers can take locks in inconsistent orders. Generally a
child record will be locked before its parent, but not in all cases.

My proposal modifies the order in which locks are taken by referential
integrity triggers, so that parents are always locked before their
children.

The proposal is, that referential integrity triggers should fire before
locking the tuple from which they are triggered. I guess a new sort of
trigger is required for this, a before-lock trigger.

If this is a dumb idea, please tell me why. If it would cause more
problems than it solves, ditto. If it would be difficult to implement,
let's discuss and try to find solutions.

__
Marc

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2007-02-08 16:51:11 Re: [pgsql-patches] Phantom Command IDs, updated patch
Previous Message Heikki Linnakangas 2007-02-08 16:38:34 Re: [pgsql-patches] Phantom Command IDs, updated patch