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 1lRywy-0007jK-3e for pgsql-general@arkaria.postgresql.org; Thu, 01 Apr 2021 15:09:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lRyww-0007ao-Nt for pgsql-general@arkaria.postgresql.org; Thu, 01 Apr 2021 15:09:34 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lRyww-0007ah-GY for pgsql-general@lists.postgresql.org; Thu, 01 Apr 2021 15:09:34 +0000 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lRywu-0002sd-21 for pgsql-general@lists.postgresql.org; Thu, 01 Apr 2021 15:09:33 +0000 Received: by mail-pl1-x634.google.com with SMTP id o2so1179894plg.1 for ; Thu, 01 Apr 2021 08:09:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:content-transfer-encoding:from:mime-version:subject:date :message-id:references:cc:in-reply-to:to; bh=hs70CyMmT5fH5Nz4KQbIYjr3IBi1dtJNT5TacJvth4Q=; b=kqBKc90RS8uw3ThGCDG2gLjlxsn3vr8HPZAYT0VYHsEF4BsFtKVA8qPyiPrLVmF4Ac TOIn686mBTglXp6sGgNSXLxTGbmy63Jx//7DKXCYdzw9R/28R6UruZAT3AfzypmED5HS uSUG06C8a0+DS/SYK0ylUpiQsfFDc/6F2VF8V1zSps3C/Ljd+QGsLS7AQLXjSq/0qVXB h48nEPLtphAj+6EmxkvEETgxLnhHi4BZLlC8lLYBSEWASp5cOMoQGqYlYjRyd+g2Tly8 Uq6N9jJUOQqqnsBWb/D3xLRZEntC6d200cOFxau0VQAxpx+0CTW825xQ/ly4jtGXkyto 8vFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:content-transfer-encoding:from :mime-version:subject:date:message-id:references:cc:in-reply-to:to; bh=hs70CyMmT5fH5Nz4KQbIYjr3IBi1dtJNT5TacJvth4Q=; b=E6LbOl0ION48DaB2WYLBYi3edDBlFjldcowunA31cDLA3GPMgOgLFD9ubaLH7SHZMs tF3zXuKwpYnmMu4BXfKl15fy9qovPSr2QBf8jXREgRG00xdmUki+/uGImq8lqtUiohRG vVDYlX4BNGxx9GrzYT4ttJZsMJj2mQWO+pFt2jts2RrLJRGxDoGU0jiaJrDrQctQcGC2 tQMxtypJuYiTrbVcRCVm6sPuGMd2qiu/BFbkGdDJdDOu5bf+6QJNhm+b/csGM/WxHuY3 BUanooHsam4rNw/6Ku+c0A6y7Np2LzrXM2y77/RCYqaPtFcuzvVCAoiaL86Ob5fWAuIn nJvw== X-Gm-Message-State: AOAM532qxohi0OMcU2s+xP24hU6k9k5Zc8mSjpmNmLitgYrBv776U7b+ 9sxrA8sTwXdHS5hkFOb5n8YBgTrsB+kxCQ== X-Google-Smtp-Source: ABdhPJxLxGbgj+loeov3wKb9bApUK5dxYuOvPV8VgzZTPwVzAGdjWpzX637Aed7Tt/7x9TED7TpuKw== X-Received: by 2002:a17:90a:b903:: with SMTP id p3mr9145694pjr.182.1617289770746; Thu, 01 Apr 2021 08:09:30 -0700 (PDT) Received: from [192.168.1.21] (67.230.181.248.16clouds.com. [67.230.181.248]) by smtp.gmail.com with ESMTPSA id j3sm4967432pfc.49.2021.04.01.08.09.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 01 Apr 2021 08:09:30 -0700 (PDT) Sender: Glen Huang Content-Type: multipart/alternative; boundary=Apple-Mail-0DF9BC5C-C189-49B6-ADDF-E9E8083FA9EA Content-Transfer-Encoding: 7bit From: Glen Huang Mime-Version: 1.0 (1.0) Subject: Re: Is replacing transactions with CTE a good idea? Date: Thu, 1 Apr 2021 23:09:27 +0800 Message-Id: <75F6F752-5A32-46AC-B314-28403915DBA2@gmail.com> References: Cc: "pgsql-generallists.postgresql.org" In-Reply-To: To: Dave Cramer X-Mailer: iPhone Mail (18D52) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Apple-Mail-0DF9BC5C-C189-49B6-ADDF-E9E8083FA9EA Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable No, but are they equivalent to serializable transactions? > On Apr 1, 2021, at 11:04 PM, Dave Cramer wrote= : >=20 > =EF=BB=BF >=20 >=20 >=20 >> On Thu, 1 Apr 2021 at 10:50, Glen Huang wrote: >> Hi all, >>=20 >> =46rom application=E2=80=99s standpoint, it seems using CTE saves a lot w= ork. You no longer need to parse values out only to pass them back in, and o= nly one round-trip to the db server. >>=20 >> If I=E2=80=99m not wrong, CTE is equivalent to serializable transactions?= So I guess the downsize is that quarries can=E2=80=99t be run in parallel? >=20 > I do not think a CTE changes the isolation level.=20 >>=20 >> If I decide to replace all my transaction code with CTE, will I shoot mys= elf in the foot down the road? >=20 >=20 > Dave Cramer > www.postgres.rocks=20 --Apple-Mail-0DF9BC5C-C189-49B6-ADDF-E9E8083FA9EA Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
No, but are they equivalen= t to serializable transactions?

On Apr 1, 2021, at 11:04 PM, Dave Cramer <davecramer@postgres.rock= s> wrote:

=EF=BB=BF



On Thu, 1 Apr 2021 at 10:50, Glen Huang <heyhgl@gmail.com> wrote:
Hi all,

=46rom application=E2=80=99s standpoint, it seems using CTE saves a lot work= . You no longer need to parse values out only to pass them back in, and only= one round-trip to the db server.

If I=E2=80=99m not wrong, CTE is equivalent to serializable transactions? So= I guess the downsize is that quarries can=E2=80=99t be run in parallel?
=

I do not think a CTE changes the isolation l= evel. 

If I decide to replace all my transaction code with CTE, will I shoot myself= in the foot down the road?


Da= ve Cramer
www.postgres.rocks 
= --Apple-Mail-0DF9BC5C-C189-49B6-ADDF-E9E8083FA9EA--