Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id CC4A09FA4AD for ; Wed, 18 Oct 2006 11:58:28 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 02005-05 for ; Wed, 18 Oct 2006 14:57:43 +0000 (UTC) X-Greylist: delayed 00:33:02.179643 by SQLgrey- Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 5332E9FB3FC for ; Wed, 18 Oct 2006 11:57:36 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from mail.ritek.hu (mail.ritek.hu [82.131.192.50]) by svr4.postgresql.org (Postfix) with ESMTP id 68BDB5AF8C9 for ; Wed, 18 Oct 2006 14:24:35 +0000 (GMT) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.ritek.hu (Postfix) with ESMTP id 08F8B8A8790 for ; Wed, 18 Oct 2006 16:24:30 +0200 (CEST) Received: from mail.ritek.hu ([127.0.0.1]) by localhost (mail.ritek.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 14645-02 for ; Wed, 18 Oct 2006 16:24:29 +0200 (CEST) Received: from [10.1.2.11] (unknown [10.1.2.11]) by mail.ritek.hu (Postfix) with ESMTP id 031208A878F for ; Wed, 18 Oct 2006 16:24:29 +0200 (CEST) Message-ID: <4536391E.7040604@ritek.hu> Date: Wed, 18 Oct 2006 16:24:30 +0200 From: Atesz User-Agent: Thunderbird 1.5.0.7 (Windows/20060909) MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: ACCESS EXCLUSIVE lock Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at ritek.hu X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=UPPERCASE_25_50 X-Spam-Level: X-Archive-Number: 200610/357 X-Sequence-Number: 21486 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