X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A81615321A for ; Mon, 9 May 2005 16:18:52 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 75507-03 for ; Mon, 9 May 2005 19:18:48 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 051EC53609 for ; Mon, 9 May 2005 16:18:45 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j49JIeA2000516; Mon, 9 May 2005 15:18:40 -0400 (EDT) To: Simon Riggs Cc: Kris Kiger , pgsql-admin@postgresql.org Subject: Re: Concurrency In-reply-to: <1115665123.3830.38.camel@localhost.localdomain> References: <671060015.20031010095617@roaddep.ru> <427F9C06.3070206@musicrebellion.com> <1115665123.3830.38.camel@localhost.localdomain> Comments: In-reply-to Simon Riggs message dated "Mon, 09 May 2005 19:58:43 +0100" Date: Mon, 09 May 2005 15:18:40 -0400 Message-ID: <515.1115666320@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200505/97 X-Sequence-Number: 17526 Simon Riggs writes: > On Mon, 2005-05-09 at 12:21 -0500, Kris Kiger wrote: >> Quick question. I lock a table, call it table X, and then issue two >> updates on that table. The two updates are left waiting. I then unlock >> the table. The two updates go through. My question is, is there a >> predictable way to determine which query will be executed first? > The lock queue is served in FIFO sequence. ... usually. We will promote later arrivals in front of older ones if the alternative would be a deadlock (eg, the later one already holds some lock that would block the earlier one). regards, tom lane