Crash Course: Postgres data storage topology Every row in a table in Postgres is stored as a tuple. Tuples are stored in an 8 KB container referred to as a page. A page is a range of space within an actual file on disk, located within the file via an offset. These files exist within a directory for the specific database that they make up, and are up to 1 GB in size. Example: $PGDATA/ └── base ├── 16384/ # database OID (example) │ ├── 24576 # table heap (main fork, relfilenode) │ ├── 24576.1 # next 1GB segment (if large) │ ├── 24590 # index relfilenode (e.g. pkey) └── 16385/ # another database OID (example) In the above tree, the directory 16384/ represents a database. The files represent relations (tables, indexes, etc.) and each contain pages. In those pages are tuples. A page looks something like: +-------------------------------------------------------+ | header | line pointers | free space | tuple data | +-------------------------------------------------------+ tuple data area: |…
No comments yet. Log in to reply on the Fediverse. Comments will appear here.