{"Entry":{"collection":"storage","key":"fork-main","name":"main fork","aliases":[],"metadata":{"aliases":[],"category":"Relation forks","content_hash":"bfe645087c5dba79074341ba6a7521bccf73af4507e45a60b42d7f1793e09b27","derived_content_hash":"55a7609f01bed4c8321cd98f68f2ca0fad6f9515a3dc7fc9dd49931245208829","imported_at":"2026-09-30T00:40:47.132084+08:00","name":"main fork","name_zh":"","slug":"fork-main","summary":"Each table and index is stored in a separate file. For ordinary relations, these files are named after the table or index's filenode number, which can be found in pg_class . relfilenode . But for temporary relations, the file name is of the form t BBB _ FFF , where BBB is the process number of the backend which created the file, and FFF is the filenode number. In either case, in addition to the main file (a/k/a main fork), each table and index has a free space map (see Section 66.3 ), which stores information about free space available in the relation. The free space map is stored in a file named with the filenode number plus the suffix _fsm . Tables also have a visibility map , stored in a fork with the suffix _vm , to track which pages are known to have no dead tuples. The visibility map is described further in Section 66.4 . Unlogged tables and indexes have a third fork, known as the initialization fork, which is stored in a fork with the suffix _init (see Section 66.5 )."}},"Definition":{"Collection":"storage","Key":"fork-main","SourceDatabase":"center","Version":"18","SourceTable":"storage_structure","SourceKey":"fork-main","SourceRevision":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","Facts":{"comparison_data":{"fork":"main"},"comparison_hash":"9d354a5e3ce1acfea4ce84c5aa725c3ea2533ffd4a9717a0a64fba8f72e4706c","description":["Each table and index is stored in a separate file. For ordinary relations, these files are named after the table or index's filenode number, which can be found in pg_class . relfilenode . But for temporary relations, the file name is of the form t BBB _ FFF , where BBB is the process number of the backend which created the file, and FFF is the filenode number. In either case, in addition to the main file (a/k/a main fork), each table and index has a free space map (see Section 66.3 ), which stores information about free space available in the relation. The free space map is stored in a file named with the filenode number plus the suffix _fsm . Tables also have a visibility map , stored in a fork with the suffix _vm , to track which pages are known to have no dead tuples. The visibility map is described further in Section 66.4 . Unlogged tables and indexes have a third fork, known as the initialization fork, which is stored in a fork with the suffix _init (see Section 66.5 ).","The pg_relation_filepath() function shows the entire path (relative to PGDATA ) of any relation. It is often useful as a substitute for remembering many of the above rules. But keep in mind that this function just gives the name of the first segment of the main fork of the relation — you may need to append a segment number and/or _fsm , _vm , or _init to find all the files associated with the relation."],"description_zh":"本节从文件和目录的层次描述存储格式。 传统上，数据库集簇所使用的配置文件和数据文件都存放在集簇的数据目录中，这个目录通常称为 PGDATA （名字来自可用于定义它的环境变量）。 PGDATA 的一个常见位置是 /var/lib/pgsql/data 。同一台机器上可以存在多个由不同服务器实例管理的集簇。 PGDATA 目录包含若干子目录和控制文件，如 表 66.1 所示。除这些必需项之外，集簇配置文件 postgresql.conf 、 pg_hba.conf 和 pg_ident.conf 传统上也存放在 PGDATA 中，不过也可以把它们放在其他地方。 对于集簇中的每个数据库， PGDATA /base 中都有一个子目录，其名称是该数据库在 pg_database 中的 OID。这个子目录是该数据库文件的默认位置；特别是，它的系统目录就存放在这里。","description_zh_html":"\u003cp\u003e存储结构 fork-main。\u003c/p\u003e\u003ch3\u003e同版本中文手册节选\u003c/h3\u003e\u003cp\u003e\n本节从文件和目录的层次描述存储格式。\n\u003c/p\u003e\u003cp\u003e\n传统上，数据库集簇所使用的配置文件和数据文件都存放在集簇的数据目录中，这个目录通常称为 \u003ccode class=\"varname\"\u003ePGDATA\u003c/code\u003e（名字来自可用于定义它的环境变量）。\u003ccode class=\"varname\"\u003ePGDATA\u003c/code\u003e 的一个常见位置是\n\u003ccode class=\"filename\"\u003e/var/lib/pgsql/data\u003c/code\u003e。同一台机器上可以存在多个由不同服务器实例管理的集簇。\n\u003c/p\u003e\u003cp\u003e\n\u003ccode class=\"varname\"\u003ePGDATA\u003c/code\u003e 目录包含若干子目录和控制文件，如\u003ca class=\"xref\" href=\"/zh/docs/18/storage-file-layout.html#PGDATA-CONTENTS-TABLE\"\u003e表 66.1\u003c/a\u003e 所示。除这些必需项之外，集簇配置文件\n\u003ccode class=\"filename\"\u003epostgresql.conf\u003c/code\u003e、\u003ccode class=\"filename\"\u003epg_hba.conf\u003c/code\u003e 和\n\u003ccode class=\"filename\"\u003epg_ident.conf\u003c/code\u003e 传统上也存放在 \u003ccode class=\"varname\"\u003ePGDATA\u003c/code\u003e\n中，不过也可以把它们放在其他地方。\n\u003c/p\u003e\u003cp\u003e\n对于集簇中的每个数据库，\u003ccode class=\"varname\"\u003ePGDATA\u003c/code\u003e\u003ccode class=\"filename\"\u003e/base\u003c/code\u003e\n中都有一个子目录，其名称是该数据库在 \u003ccode class=\"structname\"\u003epg_database\u003c/code\u003e\n中的 OID。这个子目录是该数据库文件的默认位置；特别是，它的系统目录就存放在这里。\n\u003c/p\u003e\u003cp\u003e\u003ca href=\"/zh/docs/18/storage-file-layout.html\"\u003e查看完整中文手册与上下文\u003c/a\u003e。\u003c/p\u003e","facts":[{"label":"Fork","value":"main"}],"facts_zh":[{"label":"关系分叉","value":"main"}],"manual_html":"","manual_path":"/docs/18/storage-file-layout.html","related":[{"label":"Database file layout","url":"/wiki/storage/storage-file-layout/?v=18"}],"release":{"channel":"stable","label":"18.6","major":"18","ref":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","revision":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"},"sections":[],"sections_zh":[],"signature":"","sources":[{"label":"PostgreSQL 18 English manual","path":"storage-file-layout.html","sha256":"8cdf46b5af669f41f0a77c2541863d63454ef8fbb44d22a75e576cf1a7efc9c9","url":"/docs/18/storage-file-layout.html"}],"tables":[],"tables_zh":[],"zh_from":{"authored_translation":"source-derived-identity","body_sha256":"f70fa809f3aed2bebb477c6adabd2466b1d2da4e737ed204ddf53aa5b807e3c8","kind":"same-version-chinese-manual-with-source-derived-identity","manual":{"anchor":"","build_id":107,"extraction":"concept-introduction","fragment_sha256":"257fb050d6193b915e73cee0d717b72f3e9e669fd98d6e4cebef2941b6a6378b","locale":"zh-Hans","page_key":"storage-file-layout.html","source_hash":"b919cbcb8aedb49e32e5185e2c7753b075945bb7c0e00c59b81974d853143a0a","source_revision":"unknown:rendered-translation-baseline","translated_from_revision":null,"translation_revision":"git:b1b500221dbe5437cfca004d6b04d3f6e422765d;html-sha256:08e987a66af27b98444a8057c256314eafa13611a3fb9e888214fc436824244b","url":"/zh/docs/18/storage-file-layout.html","version":"18"},"runtime_rerun":false,"source_facts_revision":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"}},"ManualEvidence":{"manual_path":"/docs/18/storage-file-layout.html","release":{"channel":"stable","label":"18.6","major":"18","ref":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","revision":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"},"sources":[{"label":"PostgreSQL 18 English manual","path":"storage-file-layout.html","sha256":"8cdf46b5af669f41f0a77c2541863d63454ef8fbb44d22a75e576cf1a7efc9c9","url":"/docs/18/storage-file-layout.html"}]},"MeasuredEvidence":{}},"Text":{"Collection":"storage","Key":"fork-main","SourceDatabase":"center","Version":"18","Locale":"en","Title":"main fork","Summary":"Each table and index is stored in a separate file. For ordinary relations, these files are named after the table or index's filenode number, which can be found in pg_class . relfilenode . But for temporary relations, the file name is of the form t BBB _ FFF , where BBB is the process number of the backend which created the file, and FFF is the filenode number. In either case, in addition to the main file (a/k/a main fork), each table and index has a free space map (see Section 66.3 ), which stores information about free space available in the relation. The free space map is stored in a file named with the filenode number plus the suffix _fsm . Tables also have a visibility map , stored in a fork with the suffix _vm , to track which pages are known to have no dead tuples. The visibility map is described further in Section 66.4 . Unlogged tables and indexes have a third fork, known as the initialization fork, which is stored in a fork with the suffix _init (see Section 66.5 ).\nThe pg_relation_filepath() function shows the entire path (relative to PGDATA ) of any relation. It is often useful as a substitute for remembering many of the above rules. But keep in mind that this function just gives the name of the first segment of the main fork of the relation — you may need to append a segment number and/or _fsm , _vm , or _init to find all the files associated with the relation.","BodyHTML":"\u003cp\u003eEach table and index is stored in a separate file. For ordinary relations, these files are named after the table or index\u0026#39;s filenode number, which can be found in pg_class . relfilenode . But for temporary relations, the file name is of the form t BBB _ FFF , where BBB is the process number of the backend which created the file, and FFF is the filenode number. In either case, in addition to the main file (a/k/a main fork), each table and index has a free space map (see Section 66.3 ), which stores information about free space available in the relation. The free space map is stored in a file named with the filenode number plus the suffix _fsm . Tables also have a visibility map , stored in a fork with the suffix _vm , to track which pages are known to have no dead tuples. The visibility map is described further in Section 66.4 . Unlogged tables and indexes have a third fork, known as the initialization fork, which is stored in a fork with the suffix _init (see Section 66.5 ).\nThe pg_relation_filepath() function shows the entire path (relative to PGDATA ) of any relation. It is often useful as a substitute for remembering many of the above rules. But keep in mind that this function just gives the name of the first segment of the main fork of the relation — you may need to append a segment number and/or _fsm , _vm , or _init to find all the files associated with the relation.\u003c/p\u003e","SourceRevision":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","ContentHash":"ad329e874516836cfcf16d367bc027319cc79c785a3025a2ac543d537d4242dc","Payload":{"description":["Each table and index is stored in a separate file. For ordinary relations, these files are named after the table or index's filenode number, which can be found in pg_class . relfilenode . But for temporary relations, the file name is of the form t BBB _ FFF , where BBB is the process number of the backend which created the file, and FFF is the filenode number. In either case, in addition to the main file (a/k/a main fork), each table and index has a free space map (see Section 66.3 ), which stores information about free space available in the relation. The free space map is stored in a file named with the filenode number plus the suffix _fsm . Tables also have a visibility map , stored in a fork with the suffix _vm , to track which pages are known to have no dead tuples. The visibility map is described further in Section 66.4 . Unlogged tables and indexes have a third fork, known as the initialization fork, which is stored in a fork with the suffix _init (see Section 66.5 ).","The pg_relation_filepath() function shows the entire path (relative to PGDATA ) of any relation. It is often useful as a substitute for remembering many of the above rules. But keep in mind that this function just gives the name of the first segment of the main fork of the relation — you may need to append a segment number and/or _fsm , _vm , or _init to find all the files associated with the relation."],"manual_html":"","related":[{"label":"Database file layout","url":"/wiki/storage/storage-file-layout/?v=18"}],"sections":[],"tables":[]}},"RequestedLocale":"en","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
