pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: D'Arcy J.M. Cain <darcy@druid.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: SELECT FOR UPDATE locks whole table
Date: Fri, 06 Dec 2002 18:00:24 -0500
Message-ID: <13898.1039215624@sss.pgh.pa.us> (raw)
In-Reply-To: <20021206190303.98BD31BA6@druid.net>
References: <20021206190303.98BD31BA6@druid.net>

"D'Arcy J.M. Cain" <darcy@druid.net> 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



view thread (4+ messages)  latest in thread

Message-ID: <13898.1039215624@sss.pgh.pa.us>
Permalink:  ../13898.1039215624@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/13898.1039215624@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, darcy@druid.net
  Subject: Re: SELECT FOR UPDATE locks whole table
  In-Reply-To: <13898.1039215624@sss.pgh.pa.us>

* 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