Re: now() vs transaction_timestamp() - Mailing list pgsql-hackers

From Tom Lane
Subject Re: now() vs transaction_timestamp()
Date
Msg-id 1037.1538892719@sss.pgh.pa.us
Whole thread Raw
In response to Re: now() vs transaction_timestamp()  (Amit Kapila <amit.kapila16@gmail.com>)
List pgsql-hackers
Amit Kapila <amit.kapila16@gmail.com> writes:
> On Sun, Oct 7, 2018 at 10:36 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> That state is restored at least two transactions too late.

> That is right, but I think we can perform shm_toc_lookup for
> PARALLEL_KEY_TRANSACTION_STATE at some earlier point and then use the
> variables from it to restore the respective state at the different
> point of times.

That hardly seems cleaner.

I think this is actually the right way, because
PARALLEL_KEY_TRANSACTION_STATE is (at least by the name) state associated
with the main transaction the worker is going to run.  But given what
I did to xact.c just now, xactStartTimestamp and stmtStartTimestamp are
*not* transaction-local state so far as the worker is concerned.  They
will persist throughout the lifetime of that process, just as the database
ID, user ID, etc, will.  So you might as well argue that none of
FixedParallelState should exist because it should all be in
PARALLEL_KEY_TRANSACTION_STATE, and that doesn't seem like much of
an improvement.

            regards, tom lane


pgsql-hackers by date:

Previous
From: Konstantin Knizhnik
Date:
Subject: Re: now() vs transaction_timestamp()
Next
From: Andres Freund
Date:
Subject: Defaulting to password_encryption = scram-sha-256