{"Entry":{"collection":"guc","key":"max_files_per_process","name":"max_files_per_process","aliases":[],"metadata":{"baseline":true,"boot_human":"Not specified","boot_val":null,"category":"Resource Usage / Kernel Resources","category_zh":"","changed_in":["13","18"],"changes":[{"documentation_changed":true,"fields":{},"from":"8.1","status":"changed","to":"8.2"},{"documentation_changed":true,"fields":{},"from":"8.4","status":"changed","to":"9.0"},{"documentation_changed":true,"fields":{},"from":"9.6","status":"changed","to":"10"},{"documentation_changed":false,"fields":{"min_val":{"from":"25","to":"64"}},"from":"12","status":"changed","to":"13"},{"documentation_changed":true,"fields":{"short_desc":{"from":"Sets the maximum number of simultaneously open files for each server process.","to":"Sets the maximum number of files each server process is allowed to open simultaneously."}},"from":"17","status":"changed","to":"18"},{"documentation_changed":true,"fields":{},"from":"18","status":"changed","to":"19"}],"content_hash":"df8f5737d53a3a5adb1b3e424317624f54950b29afdccbc538ab76da2fa9e80f","context":"","default_changed_in":[],"default_history":[{"from":"9.0","to":"19","value":"1000"}],"editorial":{"advice":{"olap":"Large partition or index fan-out can increase descriptors in one backend, but size from measured peak opens and the aggregate backend/worker count. Resolve leaks and OS service limits before changing the PostgreSQL ceiling.","oltp":"First compare the PostgreSQL value with the service's real per-process nofile limit and observed descriptor use. Raising this GUC cannot raise the kernel limit; on systems that overcommit descriptors across many processes, a lower PostgreSQL value can be safer.","small":"Keep the default unless descriptor evidence says otherwise. A small host can exhaust the system-wide file table even when every process remains below its individual limit."},"mechanism":["max_files_per_process is PostgreSQL's startup-time expectation for how many files one server subprocess may keep open, excluding files inherited already open from the postmaster.","It does not raise the kernel's file-descriptor limit. PostgreSQL uses it in resource management, and on kernels that overcommit descriptors across processes a lower value can prevent system-wide exhaustion.","The relevant capacity is per process multiplied across backends and workers. 'Too many open files' can also require fixing OS service limits, connection counts, partition fan-out, or extension behavior. Its postmaster context fixes the value at server start; changing it requires a restart."],"pitfalls":["Expecting the GUC to raise ulimit or the service manager's nofile limit.","Sizing only per process and ignoring the aggregate across connections and workers.","Raising the value to hide a descriptor leak or excessive partition/index fan-out.","Forgetting that files inherited already open from the postmaster are excluded from this count."],"references":[{"title":"PostgreSQL 19 Beta 4: max_files_per_process","url":"https://www.postgresql.org/docs/19/runtime-config-resource.html#GUC-MAX-FILES-PER-PROCESS"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["max_connections","max_worker_processes","max_wal_senders","shared_preload_libraries"],"summary":"max_files_per_process — Sets the maximum number of files each server process is allowed to open simultaneously. Observed in PG9.0–19 Beta 4; its last measured boot default is 1000 in PG19 Beta 4, with postmaster context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA."},"enumvals":[],"first_version":"7.4","group":"Resource Usage","group_slug":"resource","imported_at":"2026-09-27T17:57:31.680627+08:00","intro_commit":{},"key":"max_files_per_process","last_version":"20","max_val":"","min_val":"","name":"max_files_per_process","position":264,"present_in":["7.4","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"short_desc":"Sets the maximum number of open files each server subprocess is allowed to open simultaneously; files already opened in the postmaster are not counted toward this limit.","short_desc_zh":"","source_rev":"english-manuals:307bfb2eb0431fe9b315ef1ca83d7c18e1803d4a1419f9a77f50ab0e95473fbf","unit":"","vartype":"integer"}},"Definition":{"Collection":"guc","Key":"max_files_per_process","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"max_files_per_process","SourceRevision":"english-manuals:307bfb2eb0431fe9b315ef1ca83d7c18e1803d4a1419f9a77f50ab0e95473fbf","Facts":{"boot_val":"1000","category":"Resource Usage / Kernel Resources","context":"postmaster","description":"Sets the maximum number of open files each server subprocess is allowed to open simultaneously; files already opened in the postmaster are not counted toward this limit. The default is one thousand files. If the kernel is enforcing a safe per-process limit, you don't need to worry about this setting. But on some platforms (notably, most BSD systems), the kernel will allow individual processes to open many more files than the system can actually support if many processes all try to open that many files. If you find yourself seeing “Too many open files” failures, try reducing this setting. This parameter can only be set at server start.","doc":{"anchor":"GUC-MAX-FILES-PER-PROCESS","file":"runtime-config-resource.html","lang":"en","sha256":"2e207c599f0884dfbe594558c478a2c7c132578981071e980e2015f31dfce28c","slug":"18"},"documented":true,"enumvals":null,"extra_desc":null,"lang":"en","max_val":"2147483647","metadata_version":"18","min_val":"64","name":"max_files_per_process","short_desc":"Sets the maximum number of files each server process is allowed to open simultaneously.","source":"pg-settings-source-snapshot","unit":null,"vartype":"integer"},"ManualEvidence":{"doc":{"anchor":"GUC-MAX-FILES-PER-PROCESS","file":"runtime-config-resource.html","lang":"en","sha256":"2e207c599f0884dfbe594558c478a2c7c132578981071e980e2015f31dfce28c","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"max_files_per_process","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"max_files_per_process","Summary":"","BodyHTML":"\u003cp\u003e设置每个服务器子进程允许同时打开的最大文件数量。postmaster 中已经打开的文件不计入此上限。默认值为一千个文件。\u003c/p\u003e\u003cp\u003e如果内核强制实施了安全的每进程上限，就不必担心此设置。但在某些平台上（尤其是大多数 BSD 系统），内核允许单个进程打开的文件数量很大，如果很多进程都尝试打开这么多文件，就会远超系统实际能够支持的总量。如果遇到\u003cspan\u003e“\u003cspan\u003eToo many open files\u003c/span\u003e”\u003c/span\u003e（打开的文件过多）错误，可尝试减小此设置。此参数只能在服务器启动时设置。\u003c/p\u003e","SourceRevision":"2026-09-11@29c86d9","ContentHash":"a793e5505360ad9bdfe961bc1e90fdc9e399b5844d09f18ac9f8c8f5793674f4","Payload":{"carried_from":"","carry_reason":"","doc_html":"\u003cp\u003e设置每个服务器子进程允许同时打开的最大文件数量。postmaster 中已经打开的文件不计入此上限。默认值为一千个文件。\u003c/p\u003e\u003cp\u003e如果内核强制实施了安全的每进程上限，就不必担心此设置。但在某些平台上（尤其是大多数 BSD 系统），内核允许单个进程打开的文件数量很大，如果很多进程都尝试打开这么多文件，就会远超系统实际能够支持的总量。如果遇到\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eToo many open files\u003c/span\u003e”\u003c/span\u003e（打开的文件过多）错误，可尝试减小此设置。此参数只能在服务器启动时设置。\u003c/p\u003e","doc_same_as":""}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","7.4","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
