pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Scott Marlowe <smarlowe@g2switchworks.com>
To: Atesz <atesz@ritek.hu>
Cc: pgsql-performance@postgresql.org
Subject: Re: ACCESS EXCLUSIVE lock
Date: Wed, 18 Oct 2006 10:28:20 -0500
Message-ID: <1161185300.8706.82.camel@state.g2switchworks.com> (raw)
In-Reply-To: <4536391E.7040604@ritek.hu>
References: <4536391E.7040604@ritek.hu>

On Wed, 2006-10-18 at 09:24, Atesz wrote:
> Hi!
> 
> I have a problem with ACCESS EXCLUSIVE lock when I drop a reference in 
> transaction. I have 2 tables: 
> create table  a(id SERIAL primary key);
> create table  b(id SERIAL primary key references a(id));
> 
> After that I have 2 processes: P1, P2
> In P1:
> begin;
> ALTER TABLE b DROP CONSTRAINT  b_id_fkey;
> 
> In P2:
> SELECT * FROM a;
> 
> And I'm waiting for the result, but I don't get until P1 finishes.
> I know the DROP CONSTRAINT put an ACCESS EXCLUSIVE table LOCK into the 
> TABLE a, and the SELECT is stopped by this LOCK in P2.
> Note: I cannot commit the P1 earlier, because it's a very long 
> transaction (more hours, data conversion transaction)
> My question:  Why need this strict locking?
> 
> In my opinion there isn't exclusion between the DROP CONSTRAINT and the 
> SELECT.

What if, a minute or two after the drop contraint, you issue a rollback?



view thread (5+ messages)  latest in thread

Message-ID: <1161185300.8706.82.camel@state.g2switchworks.com>
Permalink:  ../1161185300.8706.82.camel@state.g2switchworks.com/
Also on:    postgresql.org/message-id/1161185300.8706.82.camel@state.g2switchworks.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: smarlowe@g2switchworks.com, atesz@ritek.hu
  Subject: Re: ACCESS EXCLUSIVE lock
  In-Reply-To: <1161185300.8706.82.camel@state.g2switchworks.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox