image

image

File Storage

image

image

image

image

Heap File

image

image image

Page directory

image

Page Layout

image

image

Approach 1

image

Slotted Pages

image

image

image

Ref: https://www.cs.swarthmore.edu/~soni/cs44/f18/Labs/lab2.html

More concrete example

image

Ref: Internal Layout of a Heap Table File of Postgres SQL https://www.interdb.jp/pg/pgsql01/03.html

Writing of a Tuple

Suppose a table composed of one page that contains just one heap tuple. The pd_lower of this page points to the first line pointer, and both the line pointer and the pd_upper point to the first heap tuple.

image

When the second tuple is inserted, it is placed after the first one. The second line pointer is appended to the first one, and it points to the second tuple. The pd_lower changes to point to the second line pointer, and the pd_upper to the second heap tuple.

Reading Heap tuples

Two typical access methods, sequential scan and B-tree index scan, are outlined here:

image

Record IDs

image

Tuple Layout

image

image

image

DENORMALIZED TUPLE DATA

image

image

CONCLUSION