pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Frank Millman <frank@chagford.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Question about locking
Date: Sun, 7 Aug 2022 08:22:22 +0200
Message-ID: <080a1a96-a4df-fb73-cae9-44c58258b927@chagford.com> (raw)
In-Reply-To: <d8838ea8-cc5f-854a-6e46-6ce2344d64be@gmail.com>
References: <3b981248-1b14-70a1-6366-bc4879dd9e94@chagford.com>
	<d8838ea8-cc5f-854a-6e46-6ce2344d64be@gmail.com>


On 2022-08-07 7:54 AM, Ron wrote:
> On 8/7/22 00:30, Frank Millman wrote:
>> Hi all
>>
>> Apologies if this is an FAQ, but I could not find the answer I was 
>> looking for.
>>
>> I want to run two SELECTs, one immediately after the other.
>>
>> I want to ensure that no other process updates the database in 
>> between the two.
>>
>> What is the best way to achieve this?
>
> You probably want to put the queries in a Repeatable Read transaction, 
> or even a READ ONLY serialized transaction.
> https://www.postgresql.org/docs/12/transaction-iso.html#XACT-REPEATABLE-READ 
>
> https://www.postgresql.org/docs/12/transaction-iso.html#XACT-SERIALIZABLE
> https://www.postgresql.org/docs/12/sql-set-transaction.html
>
Thanks, Ron. That is exactly what I am looking for.

Frank







view thread (3+ messages)

Message-ID: <080a1a96-a4df-fb73-cae9-44c58258b927@chagford.com>
Permalink:  ../080a1a96-a4df-fb73-cae9-44c58258b927@chagford.com/
Also on:    postgresql.org/message-id/080a1a96-a4df-fb73-cae9-44c58258b927@chagford.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: frank@chagford.com
  Subject: Re: Question about locking
  In-Reply-To: <080a1a96-a4df-fb73-cae9-44c58258b927@chagford.com>
  References: <3b981248-1b14-70a1-6366-bc4879dd9e94@chagford.com> <d8838ea8-cc5f-854a-6e46-6ce2344d64be@gmail.com> <080a1a96-a4df-fb73-cae9-44c58258b927@chagford.com>

* 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