Re: Repeatable Read Isolation Level "transaction start time" - Mailing list pgsql-general

From Tom Lane
Subject Re: Repeatable Read Isolation Level "transaction start time"
Date
Msg-id 1067324.1728155379@sss.pgh.pa.us
Whole thread Raw
In response to Re: Repeatable Read Isolation Level "transaction start time"  (Greg Sabino Mullane <htamfids@gmail.com>)
List pgsql-general
Greg Sabino Mullane <htamfids@gmail.com> 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



pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: grant connect to all databases
Next
From: Adrian Klaver
Date:
Subject: Re: grant connect to all databases