Re: a few questions (and doubts) about xid

Поиск
Список
Период
Сортировка
От Gregory Stark
Тема Re: a few questions (and doubts) about xid
Дата
Msg-id 87ps2g6h26.fsf@oxford.xeocode.com
обсуждение исходный текст
Ответ на a few questions (and doubts) about xid  (Luca Ferrari <fluca1978@infinito.it>)
Ответы Re: a few questions (and doubts) about xid  (Luca Ferrari <fluca1978@infinito.it>)
Re: a few questions (and doubts) about xid  (Luca Ferrari <fluca1978@infinito.it>)
Список pgsql-general
"Luca Ferrari" <fluca1978@infinito.it> writes:

> In short each transaction with xmin<=xid<=xmax can see such tuple,
> otherwise it cannot (of course beeing xmin and xmax different transtaction
> from xid and beeing committed), isn't it?

No, it's more complicated than that. We can't simply compare xids numerically
as you point out later. Even for regular transactions that doesn't work
because there's no guarantee that transactions will commit in the same order
they start and what matters is when they commit.

We actually check what transactions have committed at the time your
transaction starts (or command starts in read-committed mode). That's called
your "snapshot". We check the xmin and xmax from a tuple against that list.

If you really want to understand how snapshots work at this level you could
read (slowly -- it's pretty dense stuff) through
src/backend/utils/time/tqual.c:HeapTupleSatisfiesMVCC()

--
  Gregory Stark
  EnterpriseDB          http://www.enterprisedb.com


В списке pgsql-general по дате отправления:

Предыдущее
От: Gregory Stark
Дата:
Сообщение: Re: Will partial index creation use existing index?
Следующее
От: Csaba Nagy
Дата:
Сообщение: Re: Delete/update with limit