Обсуждение: snapshot question

Поиск
Список
Период
Сортировка

snapshot question

От
qihua wu
Дата:
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?

Thanks,
Qihua

Re: snapshot question

От
Bruce Momjian
Дата:
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@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

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