A file which maps internal relations (mainly system catalogue tables) to their OID is a special file which maps so-called "mapped relations" (i.e. those relations whose filenode is not stored in pg_class) to their OID. was introduced in PostgreSQL 9.0 (commit b9b8831a).

There is one file per database, and one file for the entire cluster.

Currently each file is kept to 512 bytes (intended to occupy one standard-sized disk sector) to minimize risk of failed updates; the corresponding Struct is designed to occupy exactly 512 bytes and can contain a maximum of 62 entries (MAX_MAPPINGS) of 8 bytes each:

typedef struct RelMapping
	Oid			mapoid;			/* OID of a catalog */
	Oid			mapfilenode;	/* its filenode number */
} RelMapping;

with file metadata bringing the total up to 512:

typedef struct RelMapFile
	int32		magic;			/* always RELMAPPER_FILEMAGIC */
	int32		num_mappings;	/* number of valid RelMapping entries */
	RelMapping	mappings[MAX_MAPPINGS];
	pg_crc32c	crc;			/* CRC of all above */
	int32		pad;			/* to make the struct size be 512 exactly */
} RelMapFile;

For further details, see src/backend/utils/cache/relmapper.c.


Distribution of files in a data directory:

    postgres:data$ find . -name


PostgreSQL internals, Storage