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 1lS3AH-0003c1-Fi for pgsql-general@arkaria.postgresql.org; Thu, 01 Apr 2021 19:39:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lS3AG-0004oa-6y for pgsql-general@arkaria.postgresql.org; Thu, 01 Apr 2021 19:39:36 +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 1lS3AF-0004oT-WE for pgsql-general@lists.postgresql.org; Thu, 01 Apr 2021 19:39:36 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lS3AD-0000Vf-Cp for pgsql-general@lists.postgresql.org; Thu, 01 Apr 2021 19:39:35 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1lS3A9-0002Um-5a; Thu, 01 Apr 2021 15:39:29 -0400 Date: Thu, 1 Apr 2021 15:39:29 -0400 From: Bruce Momjian To: Dave Cramer Cc: Glen Huang , "pgsql-generallists.postgresql.org" Subject: Re: Is replacing transactions with CTE a good idea? Message-ID: <20210401193929.GA18029@momjian.us> References: <7CFF1F8C-E83D-4A68-AD89-6DD3FE2E2493@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Apr 1, 2021 at 11:24:48AM -0400, Dave Cramer wrote: > CTE's don't change the isolation level. I'm not sure what you are getting at > here ? I think what he/she means here is that all queries in a CTE use a single snapshot, meaning you don't see changes by commits that happen between queries that are part of the same CTE. If you were running the queries separately in read committed mode, you would see those changes, but you would not see them in repeatable read or serializable transaction mode. -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com If only the physical world exists, free will is an illusion.