13.2.1. Read Committed Isolation Level

From: PG Doc comments form <noreply(at)postgresql(dot)org>
To: pgsql-docs(at)lists(dot)postgresql(dot)org
Cc: lebedewwasya(at)gmail(dot)com
Subject: 13.2.1. Read Committed Isolation Level
Date: 2024-07-14 06:17:37
Message-ID: 172093785742.736591.6600074945096543093@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/16/transaction-iso.html
Description:

I don't understend this text.

'INSERT with an ON CONFLICT DO UPDATE clause behaves similarly. In Read
Committed mode, each row proposed for insertion will either insert or
update. Unless there are unrelated errors, one of those two outcomes is
guaranteed. If a conflict originates in another transaction whose effects
are not yet visible to the INSERT, the UPDATE clause will affect that row,
even though possibly no version of that row is conventionally visible to the
command.

INSERT with an ON CONFLICT DO NOTHING clause may have insertion not proceed
for a row due to the outcome of another transaction whose effects are not
visible to the INSERT snapshot. Again, this is only the case in Read
Committed mode.'

And specifically this part 'the UPDATE clause will affect that row, even
though possibly no version of that row is conventionally visible to the
command.' What does it mean that no version of that row is visible to the
command? Is this visibility related to xmin xmax values? Or does it mean
that the version of the row is not visible because it has not yet been
commited by a parallel transaction?

'If a conflict originates in another transaction whose effects are not yet
visible to the INSERT' - Does this mean that at the moment of starting the
INSERT statement, the parallel transaction has not yet been committed (or
even started after calling the INSERT statement), but at the time of
performing the action with a row in the INSERT statement, transaction 2 has
already committed its changes? 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?

'INSERT with the ON CONFLICT DO NOTHING clause can result in the insertion
of a row not continuing due to the result of another transaction, whose
effects are not visible in the instantaneous snapshot of INSERT' - same
question.

Could you please describe this behavior in more detail?

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message PG Doc comments form 2024-07-14 06:47:03 13.2.2. Repeatable Read Isolation Level #
Previous Message Tom Lane 2024-07-12 13:42:24 Re: Savepoints in plpgsql