Files and Forks in Postgres

All information associated with a relation is stored in several different forks1 , each containing data of a particular type. At first, a fork is represented by a single file. Its filename consists of a numeric (oid), which can be extended by a suffix that corresponds to the fork’s type. The file grows over time, and when its size reaches 1GB, another file of this fork is created (such files are sometimes called segments). The sequence number of the segment is added to the end of its filename.

The file size limit of 1GB was historically established to support various file systems that could not handle large files. You can change this limit when building Postgres(./configure –with-segsize).

The free space map(fsm) keeps track of available space within pages. Its volume changes all the time, growing after vacuuming and getting smaller when new row versions appear. The free space map is used to quickly find a page that can accommodate new data being inserted

The visibility map(vm) can quickly show whether a page needs to be vacuumed or frozen. For this purpose, it provides two bits for each table page.

 235 total views,  2 views today

Leave a Reply

Your email address will not be published. Required fields are marked *