Re: Surprising results from tests intended to show the difference in semantics between transaction_timestamp(), statement_timestamp(), and clock_timestamp()

From: Bryn Llewellyn <bryn(at)yugabyte(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: pgsql-general list <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Surprising results from tests intended to show the difference in semantics between transaction_timestamp(), statement_timestamp(), and clock_timestamp()
Date: 2021-09-22 00:46:27
Message-ID: E40E35CB-4C08-43B9-B760-AC6FE5E5B229@yugabyte.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> Adrian Klaver wrote:
>
> On 9/21/21 4:23 PM, Bryn Llewellyn wrote:
>> I'm surprised by the results that I describe below. Please help me interpret them.
>> Briefly, why does transaction_timestamp() report a later value than statement_timestamp() when they're both invoked in the very first statement after "start transaction". (They report identical values in an implicitly started txn.)
>
> I'm not seeing it:
>
> ...
>
> No matter how many times I run this the transaction_timestamp() is less then statement_timestamp(). This is as it should be, as transaction_timestamp() fires with the begin; and statement_timestamp() fires at select ... and then updates with the subsequent select .... and clock_timestamp() just keeps marching on through the whole process.

Oh dear...

David Johnson pointed out that I was misinterpreting my results. Sigh... It all makes sense now.

Sorry to have troubled you all with this.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tim Cross 2021-09-22 01:25:27 Re: Timestamp with vs without time zone.
Previous Message Bryn Llewellyn 2021-09-22 00:42:55 Thanks, David! Re: Surprising results from tests intended to show the difference in semantics between transaction_timestamp(), statement_timestamp(), and clock_timestamp()