Re: Repeatable Read Isolation Level "transaction start time"

From: Greg Sabino Mullane <htamfids(at)gmail(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Repeatable Read Isolation Level "transaction start time"
Date: 2024-10-05 17:21:54
Message-ID: CAKAnmm+u3MH9vmgDrE6etJR_+TGYdJ8d-GjhhXAC2J51JUxTjg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

While working on a doc patch for this, I realized that the situation is
worse than I originally thought. This means that anyone relying on
pg_stat_activity.xact_start is not really seeing the time of the snapshot.
They are seeing the time that BEGIN was issued. Further, there is no way to
tell (AFAICT) when the snapshot was granted (i.e. when the transaction
actually started for purposes of MVCC comparisons). All we can guarantee
via pg_stat_activity is that if xact_start and query_start *are* identical,
no snapshot has been granted yet, and if they are not identical, then the
snapshot *might* have been granted, might not (depending on SHOW vs SELECT
for example). I suppose checking "query" could show that, but all you have
then is a general window saying that the snapshot was created sometime
after xact_start but no later than query_start (and could be a lot earlier
if this ain't query number one).

Maybe we doc patch pg_stat_activity too? Actually, let me just post my
quick work-in-progress patch here in the meantime for discussion.

Cheers,
Greg

Attachment Content-Type Size
0001-Clarify-READ-REPEATABLE-behavior-a-bit-more.patch application/octet-stream 1.2 KB

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Matt Zagrabelny 2024-10-05 18:24:47 Re: grant connect to all databases
Previous Message Adrian Klaver 2024-10-05 16:59:00 Re: Repeatable Read Isolation Level "transaction start time"