PostgreSQL Tutorial for Absolute Beginners [Administration]
About Lesson

Inside the data file (heap table and index, as well as the free space map and visibility map), it is divided into pages (or blocks) of fixed length, the default is 8192 byte (8 KB). Those pages within each file are numbered sequentially from 0, and such numbers are called as block numbers. If the file has been filled up, PostgreSQL adds a new empty page to the end of the file to increase the file size.

The internal layout of pages depends on the data file types. In this section, the table layout is described as the information that will be required in the following chapters.

Command: od -a 123454

More information: https://postgreshelp.com/postgresql-page-layout/

Visibility Map

Visibility Map is a file that records the page where garbage tuple exists. It manages each page included in the table of the file as two bits. The name of the Visibility Map file is “{RELFILENODE} _vm”. By referring to this file, PostgreSQL skips the pages, which have no garbage tuple on execution of VACUUM, and as a result, it can reduce the I/O load of VACUUM process. The initial size is 8 KB. After table creation, it is created at the first checkpoint or VACUUM time. In fact, the data, it is skipped only if the page does not exist unnecessary tuples (Visible) is continuous 32 or more

Free Space Map

Free Space Map (FSM) is a file to manage the volume of the free space in each page of the table file. It manages each page included in the file of the table at a single byte. The name of the FSM file is “{RELFILENODE}_fsm”. By referring to this file, it will be able to find the storage location of a tuple at a high speed. The initial size of this file is 24 KB. After table creation, it is created at the time of the first VACUUM execution. In addition, it will be updated every VACUUM execution. VACUUM performs processing while referring to the Visibility Map, and updates the Free Space Map.

Join the conversation