Skip site navigation (1) Skip section navigation (2)

Re: insert waiting

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Ulrich Wisser <ulrich(dot)wisser(at)relevanttraffic(dot)se>
Cc: John Sidney-Woollett <johnsw(at)wardbrook(dot)com>,pgsql-general(at)postgresql(dot)org
Subject: Re: insert waiting
Date: 2004-08-20 15:58:51
Message-ID: 20040820085349.A91391@megazone.bigpanda.com (view raw or flat)
Thread:
Lists: pgsql-general
On Fri, 20 Aug 2004, Ulrich Wisser wrote:

> but how long is the exclusive lock taken? For the whole transaction?

Until transaction end.

> My jobs are quite big, and transactions usually take several minutes.
> I can not afford have all my other jobs stalled for that time.

Generally right now your options are:
 Remove the constraint
 Edit the code to remove the FOR UPDATE clauses used in the constraint
 Defer the constraint (thus the locks are only taken at the end for
  pretty much the time to check the constraints).  This however means
  that you're accumulating the deferred constraint information which
  takes RAM.

None of these are complete fixes.  The complete fix is changing the
constraint to use a different locking mechanism (that doesn't currently
exist). Another partial fix that's been described to me would be to see if
strengthening the locks on actions on the referenced table would allow
weakening of the locks on the referencing table.

In response to

pgsql-general by date

Next:From: Greg StarkDate: 2004-08-20 16:08:45
Subject: Log Clutter
Previous:From: OlegDate: 2004-08-20 15:46:05
Subject: problem with postgresql-dump while upgrading to 7.4 format

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group