pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@commandprompt.com>
To: Federico <rotellaro@gmail.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Question about HeapTupleHeaderData
Date: Fri, 25 May 2007 10:30:10 -0400
Message-ID: <20070525143010.GF4239@alvh.no-ip.org> (raw)
In-Reply-To: <a3e8e2210705240156g3171d634uba713af4b7ef0678@mail.gmail.com>
References: <a3e8e2210705240156g3171d634uba713af4b7ef0678@mail.gmail.com>

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-1...

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



view thread (2+ messages)

Message-ID: <20070525143010.GF4239@alvh.no-ip.org>
Permalink:  ../20070525143010.GF4239@alvh.no-ip.org/
Also on:    postgresql.org/message-id/20070525143010.GF4239@alvh.no-ip.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: alvherre@commandprompt.com, rotellaro@gmail.com
  Subject: Re: Question about HeapTupleHeaderData
  In-Reply-To: <20070525143010.GF4239@alvh.no-ip.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox