Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id C01E49FC170 for ; Fri, 25 May 2007 11:30:34 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 49686-02 for ; Fri, 25 May 2007 11:30:17 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from lists.commandprompt.com (host-254.commandprompt.net [207.173.203.254]) by postgresql.org (Postfix) with ESMTP id 108E59FC190 for ; Fri, 25 May 2007 11:30:16 -0300 (ADT) Received: from perhan.alvh.no-ip.org (201-221-217-243.bk12-dsl.surnet.cl [201.221.217.243]) (authenticated bits=0) by lists.commandprompt.com (8.13.7/8.13.6) with ESMTP id l4PEUDaW010976; Fri, 25 May 2007 07:30:14 -0700 Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 9BBA132A14; Fri, 25 May 2007 10:30:10 -0400 (CLT) Date: Fri, 25 May 2007 10:30:10 -0400 From: Alvaro Herrera To: Federico Cc: pgsql-admin@postgresql.org Subject: Re: Question about HeapTupleHeaderData Message-ID: <20070525143010.GF4239@alvh.no-ip.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.13 (2006-08-11) X-Virus-Scanned: ClamAV version 0.88.5, clamav-milter version 0.88.5 on projects.commandprompt.com X-Virus-Status: Clean X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by milter-greylist-1.6 (lists.commandprompt.com [192.168.2.159]); Fri, 25 May 2007 07:30:15 -0700 (PDT) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200705/283 X-Sequence-Number: 25603 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