Re: Why does exec_simple_query requires 2 snapshots

From: Andy Fan <zhihuifan1213(at)163(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Why does exec_simple_query requires 2 snapshots
Date: 2025-02-19 08:50:05
Message-ID: 87frkab9oi.fsf@163.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> Andy Fan <zhihuifan1213(at)163(dot)com> writes:
>> Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
>>> Many years ago, we committed a patch to do exactly that. We had
>>> to back it out again because it broke too many real-world scenarios.
>>> I'm too lazy to search the archives for you, but you might be able
>>> to find the commit and revert by searching the git history.
>
>> Commit id is 532994299e2, thank you Tom!
>
> links in commit messages till some years after that.

Links in commit messages is a really great change.

I have found more details at [1], the issue can be summaried as IIUC:

The current strategy is below:
t1: snapshot1
parser&planner
t2: snapshot2
executor.

which makes the committed tuple between (t1, t2] are visible to user, but if
we share the same snapshot, the committed tuple would not be visible to
user, Chaning it would be a behavior change.

[1] https://www.postgresql.org/message-id/5075D8DF.6050500%40fuzzy.cz

--
Best Regards
Andy Fan

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bertrand Drouvot 2025-02-19 09:24:41 Re: Remove wal_[sync|write][_time] from pg_stat_wal and track_wal_io_timing
Previous Message Fujii Masao 2025-02-19 08:49:35 Re: Extend postgres_fdw_get_connections to return remote backend pid