{"Entry":{"collection":"guc","key":"max_replication_slots","name":"max_replication_slots","aliases":[],"metadata":{"baseline":false,"boot_human":"Not specified","boot_val":null,"category":"Replication / Sending Servers","category_zh":"","changed_in":["9.6","10"],"changes":[{"documentation_changed":false,"fields":{},"from":"9.3","status":"added","to":"9.4"},{"documentation_changed":true,"fields":{"max_val":{"from":"8388607","to":"262143"}},"from":"9.5","status":"changed","to":"9.6"},{"documentation_changed":true,"fields":{"boot_val":{"from":"0","to":"10"}},"from":"9.6","status":"changed","to":"10"},{"documentation_changed":true,"fields":{},"from":"10","status":"changed","to":"11"},{"documentation_changed":true,"fields":{},"from":"11","status":"changed","to":"12"},{"documentation_changed":true,"fields":{},"from":"13","status":"changed","to":"14"},{"documentation_changed":true,"fields":{},"from":"15","status":"changed","to":"16"},{"documentation_changed":true,"fields":{},"from":"16","status":"changed","to":"17"},{"documentation_changed":true,"fields":{},"from":"17","status":"changed","to":"18"}],"content_hash":"951c7fbf519a3475ab2762c737532e98faff4e93d59496b55b38a89314183f8a","context":"","default_changed_in":["10"],"default_history":[{"from":"9.4","to":"9.6","value":"0"},{"from":"10","to":"19","value":"10"}],"editorial":{"advice":{"olap":"Allow for logical consumers and migration jobs, but remember that high-WAL batch periods magnify the cost of any abandoned slot. Monitor restart_lsn and confirmed_flush_lsn before and during bulk work.","oltp":"Budget slots from named physical standbys, logical subscriptions, CDC consumers, backup or migration tools, failover slots, and provisioning headroom. Keep a small reserve, but pair a larger ceiling with ownership, expiry, and lag monitoring.","small":"Keep the ceiling close to the real consumer count plus limited reserve. A large value does not itself retain WAL, but it makes unmanaged slot sprawl easier and can turn a small disk incident into an outage."},"mechanism":["PostgreSQL allocates replication-slot control capacity at server start. Physical slots can reserve WAL for standbys, while logical slots can reserve both WAL and catalog visibility information for decoding consumers.","The setting limits slot objects, not active WAL-sender connections; max_wal_senders is a separate limit. Slot use also requires wal_level = replica or higher. Reducing the setting below the number of existing slots prevents the server from starting.","An unused slot is not harmless merely because it has no active process. A persistent inactive slot can retain WAL, and a logical slot can hold catalog_xmin, so slot inventory and consumer lifecycle are as important as the numerical ceiling."],"pitfalls":["Confusing the slot limit with max_wal_senders, which limits concurrent sender processes.","Lowering the value below the current slot count and making PostgreSQL fail to start.","Assuming inactive slots cannot retain WAL or catalog row versions.","Raising the ceiling without monitoring restart_lsn, catalog_xmin, and consumer health.","Creating permanent slots during experiments and never dropping them."],"references":[{"title":"PostgreSQL 19 Beta 4: max_replication_slots","url":"https://www.postgresql.org/docs/19/runtime-config-replication.html#GUC-MAX-REPLICATION-SLOTS"},{"title":"PostgreSQL 18: Replication Slots","url":"https://www.postgresql.org/docs/18/warm-standby.html#STREAMING-REPLICATION-SLOTS"},{"title":"PostgreSQL 18: pg_replication_slots","url":"https://www.postgresql.org/docs/18/view-pg-replication-slots.html"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["max_wal_senders","max_slot_wal_keep_size","wal_level","idle_replication_slot_timeout","max_logical_replication_workers","primary_slot_name"],"summary":"max_replication_slots — Sets the maximum number of simultaneously defined replication slots. Observed in PG9.4–19 Beta 4; its last measured boot default is 10 in PG19 Beta 4, with postmaster context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA."},"enumvals":[],"first_version":"9.4","group":"Replication","group_slug":"replication","imported_at":"2026-09-27T17:57:31.736717+08:00","intro_commit":{"authored_at":"2014-01-31T22:45:17-05:00","discussion":[],"hash":"858ec11858a914d4c380971985709b6d6b7dd6fc","subject":"Introduce replication slots.","url":"https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=858ec11858a914d4c380971985709b6d6b7dd6fc"},"key":"max_replication_slots","last_version":"20","max_val":"","min_val":"","name":"max_replication_slots","position":282,"present_in":["9.4","9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"short_desc":"Specifies the maximum number of replication slots (see Section 26.2.6) that the server can support.","short_desc_zh":"","source_rev":"english-manuals:6bc5afef125e967b01d25b47da62cb54f6e74ac2b740bd0accba86f9dd944b13","unit":"","vartype":"integer"}},"Definition":{"Collection":"guc","Key":"max_replication_slots","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"max_replication_slots","SourceRevision":"english-manuals:6bc5afef125e967b01d25b47da62cb54f6e74ac2b740bd0accba86f9dd944b13","Facts":{"boot_val":"10","category":"Replication / Sending Servers","context":"postmaster","description":"Specifies the maximum number of replication slots (see Section 26.2.6) that the server can support. The default is 10. This parameter can only be set at server start. Setting it to a lower value than the number of currently existing replication slots will prevent the server from starting. Also, wal_level must be set to replica or higher to allow replication slots to be used.","doc":{"anchor":"GUC-MAX-REPLICATION-SLOTS","file":"runtime-config-replication.html","lang":"en","sha256":"c78480a202f8579e2655e080060afe4859c9eb26a16318fb9099dabb178fb32d","slug":"18"},"documented":true,"enumvals":null,"extra_desc":null,"lang":"en","max_val":"262143","metadata_version":"18","min_val":"0","name":"max_replication_slots","short_desc":"Sets the maximum number of simultaneously defined replication slots.","source":"pg-settings-source-snapshot","unit":null,"vartype":"integer"},"ManualEvidence":{"doc":{"anchor":"GUC-MAX-REPLICATION-SLOTS","file":"runtime-config-replication.html","lang":"en","sha256":"c78480a202f8579e2655e080060afe4859c9eb26a16318fb9099dabb178fb32d","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"max_replication_slots","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"max_replication_slots","Summary":"","BodyHTML":"\u003cp\u003e指定服务器可以支持的复制槽（见\u003ca href=\"/docs/18/warm-standby.html#STREAMING-REPLICATION-SLOTS\" rel=\"nofollow\"\u003e第 26.2.6 节\u003c/a\u003e）最大数量。默认值为10。这个参数只能在服务器启动时设置。将它设置为一个比当前已有复制槽要少的值会阻碍服务器启动。此外，要允许使用复制槽，\u003ccode\u003ewal_level\u003c/code\u003e必须被设置为\u003ccode\u003ereplica\u003c/code\u003e或更高。\u003c/p\u003e","SourceRevision":"2026-09-11@29c86d9","ContentHash":"b9a001312786c70a398408a4f1cc4ed11ca684a7cf9a7fce338adff1d011d6cd","Payload":{"carried_from":"","carry_reason":"","doc_html":"\u003cp\u003e指定服务器可以支持的复制槽（见\u003ca href=\"/docs/18/warm-standby.html#STREAMING-REPLICATION-SLOTS\" title=\"26.2.6. 复制槽\"\u003e第 26.2.6 节\u003c/a\u003e）最大数量。默认值为10。这个参数只能在服务器启动时设置。将它设置为一个比当前已有复制槽要少的值会阻碍服务器启动。此外，要允许使用复制槽，\u003ccode class=\"varname\"\u003ewal_level\u003c/code\u003e必须被设置为\u003ccode class=\"literal\"\u003ereplica\u003c/code\u003e或更高。\u003c/p\u003e","doc_same_as":""}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","9.4","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
