2

I am trying to understand what is TID and how it works. I found 2 definitions of TID in the documentation:

1) from https://www.postgresql.org/docs/11/datatype-oid.html

A final identifier type used by the system is tid, or tuple identifier (row identifier). This is the data type of the system column ctid. A tuple ID is a pair (block number, tuple index within block) that identifies the physical location of the row within its table.

2) from https://www.postgresql.org/docs/11/storage-page-layout.html

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.

I understand the second definition and it's clear for me, but I struggle with the first definition and the terms it uses.

What are block and tuple index within block? How do they match with pages and the second definition?

Please help and clarify, which definition is correct and how should I understand the terms from the first definition.

2

“Page” and “block” are synonyms in PostgreSQL and refer to the 8KB block of data that is the unit for all object storage. One tends to use the term “block” when speaking of disk storage and “page” when the data reside in memory, but it is the same.

So a tid of (42,9) means that the item is the ninth element in the 43rd 8KB block of the table or index (blocks are counted from 0).

1
  • Thanks you for answer! – Frank59 Dec 5 '19 at 9:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.