Re: snapshot question

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: qihua wu <staywithpin(at)gmail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: snapshot question
Date: 2022-12-07 02:32:03
Message-ID: Y4/7I4zz+Y6AYZhQ@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Dec 7, 2022 at 10:20:09AM +0800, qihua wu wrote:
> Per the following link: https://www.sobyte.net/post/2022-08/postgres-snapshot/
> To get a snapshot we need to know xmin, xmax and xip. my question is why do we
> need them? Since every tuple in a page has t_xmin and t_xmax based on the page
> layout(https://www.postgresql.org/docs/current/storage-page-layout.html), if we
> has a snapshot at xip 12345, couldn't we just check every tuple whose t_xmin is
> lower than 12345 and already committed?

See, slides 9-11:

https://momjian.us/main/presentations/internals.html#mvcc

xip is a list of transaction that were open at the time the snapshot was
taken. If the transaction commits after the snapshot is taken, it is
still invisible.

--
Bruce Momjian <bruce(at)momjian(dot)us> https://momjian.us
EDB https://enterprisedb.com

Embrace your flaws. They make you human, rather than perfect,
which you will never be.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ryo Yamaji (Fujitsu) 2022-12-07 03:03:27 RE: About row locking ordering
Previous Message qihua wu 2022-12-07 02:20:09 snapshot question