Home > Software engineering >  PostgreSQL : Difference between ItemIdData & CTID
PostgreSQL : Difference between ItemIdData & CTID

Time:07-21

According to postgres documentation :

ItemIdData is an Array of item identifiers pointing to the actual items. Each entry is an (offset,length) pair.

&

CTID is The physical location of the row. and this is also pair.

Please help to understand that whether both are same?

Thanks ..!

CodePudding user response:

I can find only one mention of ItemIdData in the postgres docs, and that is in the Database Page Layout section. It explains the difference quite well:

Every table […] is stored as an array of pages of a fixed size.

Following the page header are item identifiers (ItemIdData), each requiring four bytes. An item identifier contains a byte-offset to the start of an item, its length in bytes, and a few attribute bits which affect its interpretation. […] Because an item identifier is never moved until it is freed, its index can be used on a long-term basis to reference an item, even when the item itself is moved around on the page to compact free space. In fact, every pointer to an item (ItemPointer, also known as CTID) created by PostgreSQL consists of a page number and the index of an item identifier.

      (Emphasis mine)

So no, they're not the same.

  • Related