pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Dominique Devienne <ddevienne@gmail.com>
Cc: Erik Wienhold <ewie@ewie.name>
Cc: Lorusso Domenico <domenico.l76@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: rollback to savepoint issue
Date: Mon, 04 Sep 2023 10:58:06 -0400
Message-ID: <1157046.1693839486@sss.pgh.pa.us> (raw)
In-Reply-To: <CAFCRh--7b92tMA1OSfnOp7pTu9O2rtSW1N-0HjWkn2XA-MeCUQ@mail.gmail.com>
References: <CAJMpnG7DAcz4ckE_GGN4VkjaJvzVrdwCYwjH+ocLnVVYvb-fcQ@mail.gmail.com>
	<1341766181.156278.1693831501720@office.mailbox.org>
	<CAFCRh--7b92tMA1OSfnOp7pTu9O2rtSW1N-0HjWkn2XA-MeCUQ@mail.gmail.com>

Dominique Devienne <ddevienne@gmail.com> writes:
> Hi Erik. And experts at large. What's the underlying mechanism though? An
> implicit SAVEPOINT?

Yes, savepoints and plpgsql exception blocks are built on the same
"subtransaction" infrastructure.

> Which means extra explicit round-trips to the server to establish and "move
> along" the savepoint,
> per command. Which I think is "expensive". So would anonymous DO blocks be
> a better solution?

In general, moving logic to the server side is an effective way of
removing network round trips.  That could be DO blocks, functions,
or procedures.  If you're going to execute the same code over and
over within a session, a function or procedure will probably be
a better choice than re-issuing identical DO blocks.

			regards, tom lane





view thread (10+ messages)  latest in thread

Message-ID: <1157046.1693839486@sss.pgh.pa.us>
Permalink:  ../1157046.1693839486@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1157046.1693839486@sss.pgh.pa.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: tgl@sss.pgh.pa.us, ddevienne@gmail.com, ewie@ewie.name, domenico.l76@gmail.com
  Subject: Re: rollback to savepoint issue
  In-Reply-To: <1157046.1693839486@sss.pgh.pa.us>
  References: <CAJMpnG7DAcz4ckE_GGN4VkjaJvzVrdwCYwjH+ocLnVVYvb-fcQ@mail.gmail.com> <1341766181.156278.1693831501720@office.mailbox.org> <CAFCRh--7b92tMA1OSfnOp7pTu9O2rtSW1N-0HjWkn2XA-MeCUQ@mail.gmail.com> <1157046.1693839486@sss.pgh.pa.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