Thread: Question about HeapTupleHeaderData
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? Thank you very much in advance. Regards Federico -- Federico Campoli is: @ PGDay -> Committee, http://www.pgday.it @ PLUG -> Consigliere, http://www.prato.linux.it PostgreSQL Consulting -> PGHost http://www.pghost.eu
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