Re: I think that the transaction tutorial document (3.4) should mention transaction isolation

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: noamraph(at)gmail(dot)com, pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: I think that the transaction tutorial document (3.4) should mention transaction isolation
Date: 2023-03-29 21:14:21
Message-ID: CAKFQuwZ2yZivzZBQZJrE4TtzSQb3Mqvec1WUrbgL2EHSEcfeDA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Wed, Mar 29, 2023 at 12:56 PM Bruce Momjian <bruce(at)momjian(dot)us> wrote:

> On Thu, Mar 2, 2023 at 01:55:31PM +0000, PG Doc comments form wrote:
>
> > I think that a notice saying that for absolute transaction isolation you
> > should set the default transaction isolation to serializable, and be
> > prepared to have transactions fail, and referring to the more details
> > document, would help users prevent consistency bugs.
>
> Well, the point is that the application is _not_ retrieving a value and
> setting is +100, but rather having the SQL add 100, which is kind of the
> point.

I don't think a tutorial should get into more details than that.
>

I'm on the fence, but leaning toward agreeing in principle. The following
paragraph from that page does cover the dynamics reasonably well under the
default configuration and the tutorial should assume the reader hasn't
changed the default.

"""
So transactions must be all-or-nothing not only in terms of their permanent
effect on the database, but also in terms of their visibility as they
happen. The updates made so far by an open transaction are invisible to
other transactions until the transaction completes, whereupon all the
updates become visible simultaneously.
"""

That said, the tutorial lacks any forward reference to non-tutorial
information for the reader that wants to expand their knowledge in this
area. A paragraph mentioning isolation levels, including stating the
default that the tutorial was operating under, and where that and the other
modes are defined/explained, should be added to the end of that page.

David J.

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message PG Doc comments form 2023-03-30 21:23:16 Cannot update the generation expression for a generated column / make the limitation explicit
Previous Message Bruce Momjian 2023-03-29 19:56:00 Re: I think that the transaction tutorial document (3.4) should mention transaction isolation