5

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.

asked Dec 5, 2019 at 5:24

1 Answer 1

11

“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).

answered Dec 5, 2019 at 8:25
1
  • Thanks you for answer! Commented Dec 5, 2019 at 9:12

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.