Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 99A6947641F for ; Fri, 6 Dec 2002 18:00:38 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id E76844763EF for ; Fri, 6 Dec 2002 18:00:33 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id gB6N0Opd013899; Fri, 6 Dec 2002 18:00:24 -0500 (EST) To: "D'Arcy J.M. Cain" Cc: pgsql-sql@postgresql.org Subject: Re: SELECT FOR UPDATE locks whole table In-reply-to: <20021206190303.98BD31BA6@druid.net> References: <20021206190303.98BD31BA6@druid.net> Comments: In-reply-to "D'Arcy J.M. Cain" message dated "Fri, 06 Dec 2002 14:03:02 -0500" Date: Fri, 06 Dec 2002 18:00:24 -0500 Message-ID: <13898.1039215624@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/83 X-Sequence-Number: 10671 "D'Arcy J.M. Cain" writes: > We have the following query: > SELECT certificate_id > INTO TEMP TABLE x_certs > FROM certificate > WHERE cert_status = 0 AND > certificate_id BETWEEN 1111 AND 2222 AND > client_id IN (1, 2, 3) > ORDER BY certificate_id > FOR UPDATE; > Is there any reason that this query should lock the entire certificate > table? It should only lock the selected rows ... and does, in a quick test here. Would you provide the test case that makes you think it's doing otherwise? regards, tom lane