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

ACCESS EXCLUSIVE lock

From: Atesz <atesz(at)ritek(dot)hu>
To: pgsql-performance(at)postgresql(dot)org
Subject: ACCESS EXCLUSIVE lock
Date: 2006-10-18 14:24:30
Message-ID: 4536391E.7040604@ritek.hu (view raw or flat)
Thread:
Lists: pgsql-performance
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.

Thanks for your suggestions!
Regards,
Antal Attila



Responses

pgsql-performance by date

Next:From: Heikki LinnakangasDate: 2006-10-18 14:50:35
Subject: Re: Index on two columns not used
Previous:From: Arnaud LesauvageDate: 2006-10-18 14:15:13
Subject: Re: Index on two columns not used

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