pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: D'Arcy J.M. Cain <darcy@druid.net>
To: pgsql-sql@PostgreSQL.org
Subject: SELECT FOR UPDATE locks whole table
Date: Fri, 6 Dec 2002 14:03:02 -0500
Message-ID: <20021206190303.98BD31BA6@druid.net> (raw)

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? 
 Is there something strange because of the IN clause or because it is going 
into a temporary table?  This is a production server running 7.2.2 so perhaps 
it is fixed in 7.3.

-- 
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.



view thread (4+ messages)  latest in thread

Message-ID: <20021206190303.98BD31BA6@druid.net>
Permalink:  ../20021206190303.98BD31BA6@druid.net/
Also on:    postgresql.org/message-id/20021206190303.98BD31BA6@druid.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: darcy@druid.net
  Subject: Re: SELECT FOR UPDATE locks whole table
  In-Reply-To: <20021206190303.98BD31BA6@druid.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox