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

From: Csaba Nagy <nagy(at)ecircle-ag(dot)com>
To: Marc Munro <marc(at)bloodnok(dot)com>
Cc: postgres hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Reducing likelihood of deadlocks (was referential Integrity and SHARE locks)
Date: 2007-02-08 17:06:43
Message-ID: 1170954403.3101.201.camel@coppola.muc.ecircle.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 2007-02-08 at 17:47, Marc Munro wrote:
> [snip] 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.
[snip]

The problem is that eliminating the deadlock is still not the complete
cake... the interlocking still remains, possibly leading to degraded
performance on high contention on very common parent rows. The real
solution would be when an update on the parent table's non-referenced
fields is not interlocking at all with updates of the child rows... and
I think there were some proposals to do that.

In fact one possibility to avoid this problem is vertical partitioning,
i.e. separating the non-key columns in a parallel table and updating
them there. However this is a choice only when you know it beforehand
and you're not inheriting the schema from other DBs...

Cheers,
Csaba.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Marc Munro 2007-02-08 17:44:43 Re: Reducing likelihood of deadlocks (was referential Integrity and SHARE locks)
Previous Message Bruce Momjian 2007-02-08 16:55:10 Re: [pgsql-patches] Phantom Command IDs, updated patch