public inbox for [email protected]
help / color / mirror / Atom feedFrom: Tom Lane <[email protected]>
To: Greg Sabino Mullane <[email protected]>
Cc: Adrian Klaver <[email protected]>
Cc: [email protected]
Subject: Re: Repeatable Read Isolation Level "transaction start time"
Date: Sat, 05 Oct 2024 15:09:39 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAKAnmm+u3MH9vmgDrE6etJR_+TGYdJ8d-GjhhXAC2J51JUxTjg@mail.gmail.com>
References: <CAKAnmmLt2ezcf7-LgJkO_oeqK+Ei+XB6F3pHk2mnyadRq3corQ@mail.gmail.com>
<[email protected]>
<CANzqJaBjwtzLg_bZHkokUJbtA8gy6RpHjirfdBH9OJGfn5=tmw@mail.gmail.com>
<[email protected]>
<CAKAnmmLDpwgqu071t_Q7Fq349dYAgQim1x46U1DCAiiTcUmU2A@mail.gmail.com>
<CANzqJaAAQFD_JvK=ChmfdGCRNP0G5gMtVBgF52bZiFjQxH8N_Q@mail.gmail.com>
<CAKAnmmL05Lt89EOnMW111qdUOau+dYG7u8ff5o+ckKKohnNwGg@mail.gmail.com>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<CAKAnmm+u3MH9vmgDrE6etJR_+TGYdJ8d-GjhhXAC2J51JUxTjg@mail.gmail.com>
Greg Sabino Mullane <[email protected]> writes:
> All we can guarantee
> via pg_stat_activity is that if xact_start and query_start *are* identical,
> no snapshot has been granted yet,
Surely that's not true either. xact_start = query_start implies that
the current statement is the first in its transaction (assuming
sufficiently fine-grained clock timestamps, something I'm not sure is
an entirely safe assumption). But if that statement is not simply
a BEGIN, it's likely obtained its own transaction snapshot after a
few microseconds.
As long as "read the system clock" is a distinct operation from
"read a snapshot", there are going to be skew issues here. We
could maybe eliminate that by reading the clock while holding the
lock that prevents commits while reading a snapshot, but I doubt
that anybody is going to accept that on performance grounds.
Adding a not-guaranteed-cheap syscall inside that extremely hot
code path seems unsatisfactory.
Also, we currently do guarantee that xact_start matches query_start
for the first statement of the transaction (the converse of what
I said above). Removing that guarantee in order to add some other
one wouldn't necessarily please everybody.
regards, tom lane
view thread (11+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected]
Subject: Re: Repeatable Read Isolation Level "transaction start time"
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox