TLDR Data · MISCELLANEOUS

POSTGRES RELATION FILES, FILED UNDER BASE/

boringsql.com7 min read

Summary from the TLDR Data newsletter

Postgres stores each relation as physical files identified by tablespace, database, and relfilenode, with extra forks and TOAST files appearing as needed. Logical objects and physical files are loosely coupled: operations like VACUUM FULL or REINDEX can rewrite storage and swap relfilenodes while the table's identity stays the same. Large relations also continue transparently across segmented files.