pg.ddx.io pgsql-general@postgresql.org mailing list archivehelp / color / mirror / Atom feed
From: Glen Huang <heyhgl@gmail.com>
To: Dave Cramer <davecramer@postgres.rocks>
Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Is replacing transactions with CTE a good idea?
Date: Thu, 1 Apr 2021 23:26:47 +0800
Message-ID: <C551F866-BADB-4CE1-B9D6-CE8C477811B8@gmail.com> (raw)
In-Reply-To: <CADK3HHLzbbn0EQg_rgL8iiro-LZT6fG7rHdp_WW5uB36aJKspQ@mail.gmail.com>
References: <CADK3HHLzbbn0EQg_rgL8iiro-LZT6fG7rHdp_WW5uB36aJKspQ@mail.gmail.com>
Ah, I see what you mean. You still have to wrap a CTE inside a transaction to specify the isolation level? By default, queries in a CTE run with the read committed isolation level?
> On Apr 1, 2021, at 11:10 PM, Dave Cramer <davecramer@postgres.rocks> wrote:
>
>
>
>
>> On Thu, 1 Apr 2021 at 11:09, Glen Huang <heyhgl@gmail.com> wrote:
>> No, but are they equivalent to serializable transactions?
>
> No, they are not.
>
>
>
> Dave Cramer
> www.postgres.rocks
>>
>>>> On Apr 1, 2021, at 11:04 PM, Dave Cramer <davecramer@postgres.rocks> wrote:
>>>>
>>>
>>>
>>>
>>>
>>>> On Thu, 1 Apr 2021 at 10:50, Glen Huang <heyhgl@gmail.com> wrote:
>>>> Hi all,
>>>>
>>>> From application’s 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’m not wrong, CTE is equivalent to serializable transactions? So I guess the downsize is that quarries can’t be run in parallel?
>>>
>>> I do not think a CTE changes the isolation level.
>>>>
>>>> If I decide to replace all my transaction code with CTE, will I shoot myself in the foot down the road?
>>>
>>>
>>> Dave Cramer
>>> www.postgres.rocks
view thread (22+ messages) latest in thread
Message-ID: <C551F866-BADB-4CE1-B9D6-CE8C477811B8@gmail.com> Permalink: ../C551F866-BADB-4CE1-B9D6-CE8C477811B8@gmail.com/ Also on: postgresql.org/message-id/C551F866-BADB-4CE1-B9D6-CE8C477811B8@gmail.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: heyhgl@gmail.com, davecramer@postgres.rocks Subject: Re: Is replacing transactions with CTE a good idea? In-Reply-To: <C551F866-BADB-4CE1-B9D6-CE8C477811B8@gmail.com> References: <CADK3HHLzbbn0EQg_rgL8iiro-LZT6fG7rHdp_WW5uB36aJKspQ@mail.gmail.com> <C551F866-BADB-4CE1-B9D6-CE8C477811B8@gmail.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