Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kiSPz-00066V-7W for pgsql-general@arkaria.postgresql.org; Fri, 27 Nov 2020 01:19:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kiSPw-0008Px-3f for pgsql-general@arkaria.postgresql.org; Fri, 27 Nov 2020 01:19:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kiSPv-0008Pq-S4 for pgsql-general@lists.postgresql.org; Fri, 27 Nov 2020 01:19:19 +0000 Received: from sapphire.magnetkern.de ([185.228.139.199]) by magus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kiSPo-0002sH-Qc for pgsql-general@lists.postgresql.org; Fri, 27 Nov 2020 01:19:19 +0000 Received: from titanium (p57a35b7a.dip0.t-ipconnect.de [87.163.91.122]) by sapphire.magnetkern.de (Postfix) with ESMTPSA id E5A0B2273C; Fri, 27 Nov 2020 01:19:11 +0000 (UTC) Date: Fri, 27 Nov 2020 02:19:11 +0100 From: Jan Behrens To: Mohamed Wael Khobalatte Cc: pgsql-general@lists.postgresql.org Subject: Re: Transaction isolation level Repeatable Read Read Only vs Serializable Read Only Message-Id: <20201127021911.73283b9cf15eed1b4bc9eded@magnetkern.de> In-Reply-To: References: <20201126234509.b856ad06c6c532f843163a57@magnetkern.de> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; amd64-portbld-freebsd12.1) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Thu, 26 Nov 2020 19:13:53 -0500 Mohamed Wael Khobalatte wrote: > > > > Thus, what does SERIALIZABLE READ ONLY achieve that REPEATABLE READ READ > > ONLY does not? And what is SERIALIZABLE READ ONLY DEFERRABLE for? > > > > There is a nice walkthrough of the "control" and "batches/details" scenario > mentioned in the docs, you can find it in the wiki, > and I think it > explains the difference well. Thank you, it helped me a lot. If there are two REPEATABLE READ READ WRITE transactions, which do *not* require SERIALIZABLE isolation, there could still be a third READ ONLY transaction, which has stricter requirements on isolation when retrieving data. SERIALIZABLE READ ONLY will fail under certain circumstances in which case the retrieved information should be deemed void and re-requested in a new transaction in order to fit the extra requirements on isolation of the read-only transaction. Then "DEFERRABLE" makes sense too, as it will make the third transaction block for a certain time instead of risking cancellation. Thanks Jan