> For the complete documentation index, see [llms.txt](https://docs.postgresql.tw/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.postgresql.tw/server-administration/logical-replication/logical-replication-config.md).

# 29.12. Configuration Settings \#

[29.12.1. Publishers](#LOGICAL-REPLICATION-CONFIG-PUBLISHER)

[29.12.2. Subscribers](#LOGICAL-REPLICATION-CONFIG-SUBSCRIBER)

Logical replication requires several configuration options to be set. These options are relevant only on one side of the replication.

## 29.12.1. Publishers [#](#LOGICAL-REPLICATION-CONFIG-PUBLISHER)

[`wal_level`](/server-administration/runtime-config/runtime-config-wal.md#GUC-WAL-LEVEL) must be set to `logical`.

[`max_replication_slots`](/server-administration/runtime-config/runtime-config-replication.md#GUC-MAX-REPLICATION-SLOTS) must be set to at least the number of subscriptions expected to connect, plus some reserve for table synchronization.

Logical replication slots are also affected by [`idle_replication_slot_timeout`](/server-administration/runtime-config/runtime-config-replication.md#GUC-IDLE-REPLICATION-SLOT-TIMEOUT).

[`max_wal_senders`](/server-administration/runtime-config/runtime-config-replication.md#GUC-MAX-WAL-SENDERS) should be set to at least the same as `max_replication_slots`, plus the number of physical replicas that are connected at the same time.

Logical replication walsender is also affected by [`wal_sender_timeout`](/server-administration/runtime-config/runtime-config-replication.md#GUC-WAL-SENDER-TIMEOUT).

## 29.12.2. Subscribers [#](#LOGICAL-REPLICATION-CONFIG-SUBSCRIBER)

[`max_active_replication_origins`](/server-administration/runtime-config/runtime-config-replication.md#GUC-MAX-ACTIVE-REPLICATION-ORIGINS) must be set to at least the number of subscriptions that will be added to the subscriber, plus some reserve for table synchronization.

[`max_logical_replication_workers`](/server-administration/runtime-config/runtime-config-replication.md#GUC-MAX-LOGICAL-REPLICATION-WORKERS) must be set to at least the number of subscriptions (for leader apply workers), plus some reserve for the table synchronization workers and parallel apply workers.

[`max_worker_processes`](/server-administration/runtime-config/runtime-config-resource.md#GUC-MAX-WORKER-PROCESSES) may need to be adjusted to accommodate for replication workers, at least ([`max_logical_replication_workers`](/server-administration/runtime-config/runtime-config-replication.md#GUC-MAX-LOGICAL-REPLICATION-WORKERS)

* `1`). Note, some extensions and parallel queries also take worker slots from `max_worker_processes`.

[`max_sync_workers_per_subscription`](/server-administration/runtime-config/runtime-config-replication.md#GUC-MAX-SYNC-WORKERS-PER-SUBSCRIPTION) controls the amount of parallelism of the initial data copy during the subscription initialization or when new tables are added.

[`max_parallel_apply_workers_per_subscription`](/server-administration/runtime-config/runtime-config-replication.md#GUC-MAX-PARALLEL-APPLY-WORKERS-PER-SUBSCRIPTION) controls the amount of parallelism for streaming of in-progress transactions with subscription parameter `streaming = parallel`.

Logical replication workers are also affected by [`wal_receiver_timeout`](/server-administration/runtime-config/runtime-config-replication.md#GUC-WAL-RECEIVER-TIMEOUT), [`wal_receiver_status_interval`](/server-administration/runtime-config/runtime-config-replication.md#GUC-WAL-RECEIVER-STATUS-INTERVAL) and [`wal_retrieve_retry_interval`](/server-administration/runtime-config/runtime-config-replication.md#GUC-WAL-RETRIEVE-RETRY-INTERVAL).

***

原文：[PostgreSQL 18.6 Documentation](https://www.postgresql.org/docs/18/logical-replication-config.html)（英文原文，待翻譯）


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.postgresql.tw/server-administration/logical-replication/logical-replication-config.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
