pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <bruce@momjian.us>
To: Dave Cramer <davecramer@postgres.rocks>
Cc: Glen Huang <heyhgl@gmail.com>
Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Is replacing transactions with CTE a good idea?
Date: Sun, 4 Apr 2021 09:12:31 -0400
Message-ID: <20210404131231.GA1730@momjian.us> (raw)
In-Reply-To: <CADK3HHKcZ09TLNNUvcm_++NwDQeHR=J=Qx=oZwayP5e0ZDweTw@mail.gmail.com>
References: <CADK3HHLzbbn0EQg_rgL8iiro-LZT6fG7rHdp_WW5uB36aJKspQ@mail.gmail.com>
	<7CFF1F8C-E83D-4A68-AD89-6DD3FE2E2493@gmail.com>
	<CADK3HHJ5m_dJsSsW8sLK+M9RfVWV0x42o0r8E4H1O4PtmBemiQ@mail.gmail.com>
	<20210401193929.GA18029@momjian.us>
	<CADK3HHKcZ09TLNNUvcm_++NwDQeHR=J=Qx=oZwayP5e0ZDweTw@mail.gmail.com>

On Sun, Apr  4, 2021 at 08:35:41AM -0400, Dave Cramer wrote:
> 
> 
> On Thu, 1 Apr 2021 at 15:39, Bruce Momjian <bruce@momjian.us> wrote:
> 
>     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.
> 
> OK, that makes sense, but I think it is wrong minded to think that this
> absolves one of taking isolation into account.
> 
> When you make the first read you will still have to deal with all of the
> isolation issues 

I have no idea what you are saying above.  Why is a SELECT-only CTE not
the same as a repeatable-read SELECT-only multi-statement transaction? 
Are you saying that a SELECT in a CTE doesn't do SELECT FOR UPDATE?  

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  If only the physical world exists, free will is an illusion.






view thread (22+ messages)  latest in thread

Message-ID: <20210404131231.GA1730@momjian.us>
Permalink:  ../20210404131231.GA1730@momjian.us/
Also on:    postgresql.org/message-id/20210404131231.GA1730@momjian.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 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: bruce@momjian.us, davecramer@postgres.rocks, heyhgl@gmail.com
  Subject: Re: Is replacing transactions with CTE a good idea?
  In-Reply-To: <20210404131231.GA1730@momjian.us>
  References: <CADK3HHLzbbn0EQg_rgL8iiro-LZT6fG7rHdp_WW5uB36aJKspQ@mail.gmail.com> <7CFF1F8C-E83D-4A68-AD89-6DD3FE2E2493@gmail.com> <CADK3HHJ5m_dJsSsW8sLK+M9RfVWV0x42o0r8E4H1O4PtmBemiQ@mail.gmail.com> <20210401193929.GA18029@momjian.us> <CADK3HHKcZ09TLNNUvcm_++NwDQeHR=J=Qx=oZwayP5e0ZDweTw@mail.gmail.com> <20210404131231.GA1730@momjian.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