Re: Tracking down deadlocks

From: Csaba Nagy <nagy(at)ecircle-ag(dot)com>
To: Ben <bench(at)silentmedia(dot)com>
Cc: Postgres general mailing list <pgsql-general(at)postgresql(dot)org>
Subject: Re: Tracking down deadlocks
Date: 2004-06-16 15:54:06
Message-ID: 1087401245.961.18.camel@coppola.ecircle.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Ben,

Check this mailing list for "foreign keys" and "deadlock".
Short info:
Postgres exclusively locks the referenced records of a foreign key
relationship when the child record is updated, so multiple runs (in
different transactions) of one insert query could cause deadlock if they
update rows which reference the same parent keys in reverse order.
Check your foreign keys...

HTH,
Csaba.

On Wed, 2004-06-16 at 17:33, Ben wrote:
> I'm doing a bunch of data mining against a postgres database and have
> run into an interesting problem with deadlocks. The problem is,
> postgres is detecting them and then wacking the offending process, and
> I can't figure out what's causing them. I have a ton of select queries
> (but none for update), and then a single query to insert into a table.
> Nothing selects from that table. So where could the deadlock be?
>
> pg_stat_activity has a column named current_query, which would seem
> useful in tracking this down, but it's not being populated.
>
> Oh, I'm running 7.4.2.
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faqs/FAQ.html

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2004-06-16 16:03:39 Re: Tracking down deadlocks
Previous Message Ben 2004-06-16 15:53:54 Re: Tracking down deadlocks