Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g92Ie-0006v7-IQ for pgsql-hackers@arkaria.postgresql.org; Sun, 07 Oct 2018 06:12:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g92Ia-0005D4-7P for pgsql-hackers@arkaria.postgresql.org; Sun, 07 Oct 2018 06:12:16 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g92Ia-0005Cx-0I for pgsql-hackers@lists.postgresql.org; Sun, 07 Oct 2018 06:12:16 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g92IS-0008Us-5a for pgsql-hackers@postgresql.org; Sun, 07 Oct 2018 06:12:14 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w976Bxu4001038; Sun, 7 Oct 2018 02:11:59 -0400 From: Tom Lane To: Amit Kapila cc: konstantin knizhnik , pgsql-hackers , Robert Haas Subject: Re: now() vs transaction_timestamp() In-reply-to: References: <6406dbd2-5d37-4cb6-6eb2-9c44172c7e7c@postgrespro.ru> <4268.1538747795@sss.pgh.pa.us> <4911.1538774725@sss.pgh.pa.us> <9c78b24f-4ec9-e1dd-bdf6-e09e9b5f0e31@postgrespro.ru> <14825.1538842224@sss.pgh.pa.us> <31310.1538888799@sss.pgh.pa.us> Comments: In-reply-to Amit Kapila message dated "Sun, 07 Oct 2018 10:56:10 +0530" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1036.1538892719.1@sss.pgh.pa.us> Date: Sun, 07 Oct 2018 02:11:59 -0400 Message-ID: <1037.1538892719@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Amit Kapila writes: > On Sun, Oct 7, 2018 at 10:36 AM Tom Lane 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