Re: Statement-level rollback

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Greg Stark <stark(at)mit(dot)edu>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>
Subject: Re: Statement-level rollback
Date: 2019-01-31 16:51:48
Message-ID: 201901311651.7423v77436hk@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2019-Jan-31, Greg Stark wrote:

> This looks like repeating the autocommit mistakes of the past.

Yeah, this argument has been made before. Peter E argued against that:
https://postgr.es/m/ea395aa8-5ac4-6bcd-366d-aab2ff2b05ef@2ndquadrant.com

> And based on that experience wouldn't the replacement approach be to do
> this client side?

JDBC has a feature for this already (see "autosave" in [1]), but
apparently you get a good performance improvement by doing it
server-side, which is why this was written in the first place. psql
also has ON_ERROR_ROLLBACK [2].

> If libpq had a library option to wrap every statement in a
> subtransaction by adding begin/end then this problem would be
> completely sidestepped.

I don't think anyone's talked about doing it in libpq before
specifically, and if you did that, it would obviously have to be
implemented separately on JDBC.

[1] https://jdbc.postgresql.org/documentation/head/connect.html#connection-parameters
[2] https://www.postgresql.org/docs/current/app-psql.html

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2019-01-31 17:04:51 Re: Fast path for empty relids in check_outerjoin_delay()
Previous Message Stas Kelvich 2019-01-31 16:46:45 Re: Global snapshots