Table Structure in Postgres

Table Structure in Postgres

Your Postgres tables look like this.

We have 8 KB pages, which hold our data, and each is numbered from 0 to n.

On top, we have 24bytes of header data which contains some generic info about the page like checksum, lower, upper and more.

Then we have some line pointers, which are just pointers that point to actual tuples or data.

At the end, we have actual data sorted from bottom up.

To identify a tuple, we use a tuple ID (TID), which consists of two numbers.

One of them is the page number, and the line pointer number.

e.g. TID(4, 3) indicates 4 is the page number and 3 is the line identifier.