Re: 13.2.1. Read Committed Isolation Level

From: Василий Лебедев <lebedewwasya(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: 13.2.1. Read Committed Isolation Level
Date: 2024-07-17 06:17:08
Message-ID: CAJJ74VJZV5ramu2zxWfV_2YhpbVZuA7npT=eq7Ju272giDCeRQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

Thank you for the response. Can I clarify if I understood the essence
correctly?
It turns out that despite the Read Committed isolation level, due to the
presence of a unique index, which has an independent isolation mechanism, a
transaction can "know" that a parallel transaction has performed an insert
before it commits its changes. And it will wait for the completion or
rollback of the parallel transaction, after which it will be clear whether
it can insert the row or if it needs to perform an alternative operation
(update or do nothing)? This is very interesting! I would like to see this
description in the documentation.

Why does the documentation say <Again, this is only the case in Read
Committed mode>? Is the behavior different in other isolation levels? What
is it like? The documentation does not say anything about the behavior of
INSERT in the Repeatable Read and Serializable isolation levels.

вт, 16 июл. 2024 г. в 20:38, David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>:

> On Tue, Jul 16, 2024 at 7:06 AM PG Doc comments form <
> noreply(at)postgresql(dot)org> wrote:
>
>> Or does it mean that contrary to Read
>> Committed Isolation Level, uncommitted changes from a parallel transaction
>> can affect the execution of an INSERT command?
>>
>
> This. Because you are keying off of an unique index that has independent
> isolation mechanics. Upon attempting to insert a row that will violate the
> unique constraint enforced by the index the system must wait to see whether
> the earlier transaction commits. If it doesn't, the insert proceeds. If
> it does, the conflict clause is evaluated - updating the now committed row
> (or just doing nothing if that option is specified.)
>
> David J.
>
>

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message Muhammad Ikram 2024-07-18 04:55:16 A minor bug in doc. Hovering over heading shows # besides it.
Previous Message 周志勤 2024-07-17 01:20:49 Re: Re: Mismatch for connection key/value pair between documentation and code?