Re: Question about HeapTupleHeaderData

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Question about HeapTupleHeaderData
Дата
Msg-id 20070525143010.GF4239@alvh.no-ip.org
обсуждение исходный текст
Ответ на Question about HeapTupleHeaderData  (Federico <rotellaro@gmail.com>)
Список pgsql-admin
Federico escribió:
> Hi,
> I'm writing some papers about PostgreSQL physical storage and I'm
> bumping into the  HeapTupleHeaderData layout as descripted here
> http://www.postgresql.org/docs/8.2/static/storage-page-layout.html
>
> Reading the source code in src/include/access/htup.h I got a question.
>
> The t_cmin and t_cmax stores the insert and delete CID stamps.
> the CID (command that operate on item id?) is similar to XID? where I
> can find some docs about CID and its meaning?

CID is shorthand for CommandId.  Each tuple created or destroyed in a
transaction is marked with the creation CommandId (cmin) and the
destruction CommandId (cmax).  A later command in the transaction should
not be able to see a tuple destroyed by an earlier command; and an
earlier command should not be able to see a tuple created by a later
command.

This mechanism is there to solve the so-called Halloween Problem.
http://blogs.ittoolbox.com/database/technology/archives/what-is-the-halloween-problem-in-databases-12618

The current CommandId in a transaction is incremented each time an
UPDATE/INSERT/SELECT/DELETE (etc) operation is performed.  Some utility
commands (CREATE TABLE, etc) may increment the command counter more than
once (internal implementation detail you should not care about).

--
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Abnormal storage consumption with autovacuum enabled
Следующее
От: Marsha Ramsey
Дата:
Сообщение: User DB Access - RESTRICTIONS