Re: Row not immediately visible after commit

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Steve Baldwin <steve(dot)baldwin(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Row not immediately visible after commit
Date: 2021-03-29 23:52:44
Message-ID: 064d0c00-d68e-b522-5f43-017877e07d5c@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 3/29/21 4:39 PM, Steve Baldwin wrote:
> Hi all,
>
> I know this is going to sound weird/unbelievable, but I'm trying to come
> up with an explanation for what I've observed.
>
> First, a couple of data points. The instance is running on AWS RDS and
> is on version 13.1. All my timestamps and elapsed times were taken from
> the postgres log (converted to my local tz).
>
> 2021-03-30 05:47:40.989+11 Session A begins a new transaction
> 2021-03-30 05:47:41.006+11 Session A inserts a single row into table A
> 2021-03-30 05:47:41.031+11 Session A inserts two rows into table B
> 2021-03-30 05:47:41.039+11 Session A commits (duration = 3.022 ms)
>
> 2021-03-30 05:47:41.082+11 Session B begins a new transaction
> 2021-03-30 05:47:41.083+11 Session B fetches one of the inserted rows
> from table B
> 2021-03-30 05:47:41.085+11 Session B attempts to fetch the inserted row
> from table A using the primary key. Fetch returns zero rows.
> 2021-03-30 05:47:41.087+11 Session B aborts the transaction with rollback
>
> 2021-03-30 05:47:42.143+11 Session C begins a new transaction
> 2021-03-30 05:47:42.146+11 Session C fetches the same row as session B above
> 2021-03-30 05:47:42.228+11 Session C attempts the same query on table A
> as session B above. The fetch returns 1 row, and session C continues
> processing.
>
> I can't imagine how Session B could fail to fetch the row from table A
> given that the commit has completed prior to Session B starting its
> transaction.
>
> Any suggestions?

Ask AWS support.

>
> Thanks,
>
> Steve

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2021-03-30 00:05:17 Re: = t1 - t0 but t0 + i <> t1 when t1 and t2 timestamptz values and i is an interval value
Previous Message Steve Baldwin 2021-03-29 23:39:27 Row not immediately visible after commit