X-Original-To: pgsql-admin@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 4ADDE475C9E for ; Fri, 28 Feb 2003 08:18:04 -0500 (EST) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with SMTP id 38699-01 for ; Fri, 28 Feb 2003 08:17:52 -0500 (EST) Received: from nwkea-mail-1.sun.com (nwkea-mail-1.sun.com [192.18.42.13]) by postgresql.org (Postfix) with ESMTP id E745C475D0D for ; Fri, 28 Feb 2003 03:57:58 -0500 (EST) Received: from sr-epdb01-01.Germany.Sun.COM ([129.157.48.1]) by nwkea-mail-1.sun.com (8.9.3+Sun/8.9.3) with ESMTP id AAA03747; Fri, 28 Feb 2003 00:57:53 -0800 (PST) Received: from sun.com (stuke [10.16.72.46]) by sr-epdb01-01.Germany.Sun.COM (8.9.3+Sun/8.9.3/ENSMAIL,v2.2) with ESMTP id JAA04885; Fri, 28 Feb 2003 09:57:52 +0100 (MET) Message-ID: <3E5F248F.8020606@sun.com> Date: Fri, 28 Feb 2003 09:57:51 +0100 From: "Michael A. Schulte" User-Agent: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.1) Gecko/20020827 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: Gaetano Mendola , pgsql-admin@postgresql.org Subject: Re: ExclusiveLock and Python References: <29830.1046274625@sss.pgh.pa.us> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new X-Archive-Number: 200303/12 X-Sequence-Number: 7660 Tom Lane wrote: > "Gaetano Mendola" writes: > >>select * from pg_locks where mode = 'ExclusiveLock'; >> relation | database | transaction | pid | mode | granted >>----------+----------+-------------+-------+---------------+--------- >> | | 2560899 | 20404 | ExclusiveLock | t > > >>ExclusiveLock on what ? > > > Your own transaction, that's what. > > If one transaction needs to wait for a specific other transaction, it > does so by attempting to grab ShareLock on the transaction ID. When > the other transaction completes (and releases its ExclusiveLock on its > ID), the waiter is released. > > Offhand I think this is only used to implement waits associated with > SELECT FOR UPDATE row locking --- all other locks are on tables or > table-like objects. What about two processes updating the same row? I thougth PostGres locks the row in this case and this would also be reflected as an entry in pg_locks with mode ExclusiveLock. michael -- Michael Schulte, Solaris Kernel Development, Sun Microsystems