---
title: "Replace Postgres service configuration"
method: POST
path: "/v1/organizations/{organizationId}/postgres/{postgresId}/config"
tags: ["Postgres"]
---

# Replace Postgres service configuration

`POST /v1/organizations/{organizationId}/postgres/{postgresId}/config`

## Request

- Base URL: `https://api.clickhouse.cloud`
- URL: `https://api.clickhouse.cloud/v1/organizations/{organizationId}/postgres/{postgresId}/config`
- Auth: HTTP basic

Replace the existing Postgres service and pgBouncer configuration.

## Path parameters

- `organizationId` string, uuid, required
- `postgresId` string, uuid, required

## Request body

- PostgresInstanceConfig
  - `pgConfig` PgConfig, required: Postgres [runtime configuration](https://www.postgresql.org/docs/current/runtime-config.html) configuration.
    - `max_connections` union: Sets the maximum number of concurrent connections to the database server.
      - string
      - integer
    - `default_transaction_isolation` 'read committed' | 'repeatable read' | 'serializable': Sets the default transaction isolation level for new transactions.
    - `ssl_min_protocol_version` 'TLSv1' | 'TLSv1.1' | 'TLSv1.2' | 'TLSv1.3': Sets the minimum SSL/TLS protocol version allowed for client connections.
    - `default_toast_compression` 'pglz' | 'lz4': Sets the default compression method for compressible values stored out of line (TOAST).
    - `maintenance_work_mem` union: Sets the maximum memory to be used for maintenance operations.
      - string
      - integer
    - `work_mem` union: Sets the amount of memory Postgres will use for internal operations like sorting and hashing as part of executing a query.
      - string
      - integer
    - `effective_cache_size` union: Sets the planner's assumption about the total size of data caches.
      - string
      - integer
    - `random_page_cost` union: Sets the planner's estimate of the cost of a non-sequentially-fetched disk page. Lower values (1.1-1.5) are better for SSDs.
      - string
      - number
    - `effective_io_concurrency` union: Number of concurrent disk I/O operations the planner expects. Higher values (100-200) benefit SSDs.
      - string
      - integer
    - `max_worker_processes` union: Maximum number of background processes the system can support. Includes parallel query workers, logical replication, and more.
      - string
      - integer
    - `max_parallel_workers` union: Maximum number of workers that can be used for parallel operations. Cannot exceed max_worker_processes.
      - string
      - integer
    - `max_parallel_workers_per_gather` union: Maximum number of parallel workers per executor node for parallel queries. Use 0 to disable parallel queries.
      - string
      - integer
    - `max_parallel_maintenance_workers` union: Maximum number of parallel workers for maintenance operations like CREATE INDEX and VACUUM.
      - string
      - integer
    - `shared_memory_percent` union: Percent of VM memory reserved for the shared_memory, from 25% to 75%. shared_buffers sized to fit in it. Limited to 50% on VMs with memory less or equal 16GB
      - string
      - integer
    - `temp_buffers` union: Sets the maximum memory each session uses for temporary table buffers.
      - string
      - integer
    - `hash_mem_multiplier` union: Multiple of work_mem that hash-based operations may use.
      - string
      - integer
    - `enable_parallel_hash` 'on' | 'off': Enables the planner's use of parallel hash plans.
    - `maintenance_io_concurrency` union: Number of concurrent disk I/O operations used for maintenance work such as vacuum.
      - string
      - integer
    - `io_method` 'sync' | 'worker' | 'io_uring': Selects the method used to perform asynchronous I/O. Postgres 18 and later.
    - `io_workers` union: Number of I/O worker processes used when io_method is worker. Postgres 18 only.
      - string
      - integer
    - `io_min_workers` union: Minimum number of I/O worker processes kept running when io_method is worker. Postgres 19 and later.
      - string
      - integer
    - `io_max_workers` union: Maximum number of I/O worker processes started when io_method is worker. Postgres 19 and later.
      - string
      - integer
    - `bgwriter_delay` union: Sleep time between background writer activity rounds.
      - string
      - integer
    - `bgwriter_flush_after` union: Amount of data written by the background writer after which the OS is asked to flush it to disk.
      - string
      - integer
    - `bgwriter_lru_maxpages` union: Maximum number of buffers the background writer writes per round.
      - string
      - integer
    - `bgwriter_lru_multiplier` union: Multiple of the average recent buffer demand that the background writer cleans per round.
      - string
      - integer
    - `statement_timeout` union: Abort any statement that runs longer than the specified time. Use 0 to disable.
      - string
      - integer
    - `lock_timeout` union: Abort any statement that waits longer than the specified time while attempting to acquire a lock. Use 0 to disable.
      - string
      - integer
    - `idle_session_timeout` union: Terminate any session that has been idle for longer than the specified time. Use 0 to disable.
      - string
      - integer
    - `idle_in_transaction_session_timeout` union: Terminate any session that has been idle within an open transaction for longer than the specified time. Use 0 to disable.
      - string
      - integer
    - `transaction_timeout` union: Terminate any statement that takes more than the specified time, even while active. Use 0 to disable.
      - string
      - integer
    - `wal_sender_timeout` union: Terminate replication connections that are inactive for longer than this time. Use 0 to disable.
      - string
      - integer
    - `wal_keep_size` union: Minimum size of past WAL files kept in pg_wal for standby servers. Use 0 to disable.
      - string
      - integer
    - `min_wal_size` union: Minimum size to shrink the WAL to. WAL files are recycled rather than removed when below this size.
      - string
      - integer
    - `max_wal_size` union: Maximum size WAL can grow between checkpoints. Larger values improve write performance but increase crash recovery time.
      - string
      - integer
    - `checkpoint_timeout` union: Sets the maximum time between automatic WAL checkpoints.
      - string
      - integer
    - `max_slot_wal_keep_size` union: Specifies the maximum size of WAL files that replication slots are allowed to retain. Use -1 for unlimited.
      - string
      - integer
    - `wal_compression` 'off' | 'on' | 'lz4' | 'zstd': Compress full-page writes in WAL. Reduces I/O at the cost of CPU. Options vary by PostgreSQL version.
    - `wal_buffers` union: Sets the number of disk-page buffers in shared memory for WAL. A number without a unit is in 8 kB pages.
      - string
      - integer
    - `max_replication_slots` union: Maximum number of replication slots. Standbys and logical replication each use slots.
      - string
      - integer
    - `max_wal_senders` union: Maximum number of simultaneously running WAL sender processes.
      - string
      - integer
    - `max_logical_replication_workers` union: Maximum number of logical replication workers for subscriptions on this server.
      - string
      - integer
    - `max_repack_replication_slots` union: Replication slots reserved for REPACK CONCURRENTLY, separate from max_replication_slots. Postgres 19 and later.
      - string
      - integer
    - `max_sync_workers_per_subscription` union: Maximum number of table synchronization workers per subscription.
      - string
      - integer
    - `logical_decoding_work_mem` union: Maximum memory used for logical decoding before changes spill to disk.
      - string
      - integer
    - `autovacuum_max_workers` union: Maximum number of autovacuum worker processes that can run at the same time. Workers share a single cost-limit budget, so raising this alone may not speed up vacuuming.
      - string
      - integer
    - `autovacuum_max_parallel_workers` union: Maximum number of parallel workers a single autovacuum worker can use. 0 (the default) turns parallel autovacuum off. Postgres 19 and later.
      - string
      - integer
    - `autovacuum_naptime` union: Minimum delay between autovacuum runs. Lower values make autovacuum check for work more frequently.
      - string
      - integer
    - `autovacuum_work_mem` union: Maximum memory each autovacuum worker uses to track dead tuples. Higher values reduce repeated index-vacuum passes on large tables. Use -1 to fall back to maintenance_work_mem.
      - string
      - integer
    - `autovacuum_vacuum_scale_factor` union: Fraction of a table's rows that must change before autovacuum runs. Lower values vacuum large tables more frequently.
      - string
      - number
    - `autovacuum_analyze_scale_factor` union: Fraction of a table's rows that must change before autovacuum runs ANALYZE to refresh planner statistics.
      - string
      - number
    - `autovacuum_vacuum_insert_scale_factor` union: Fraction of a table's rows that must be inserted before autovacuum runs. Helps vacuum insert-heavy, rarely-updated tables.
      - string
      - number
    - `autovacuum_vacuum_threshold` union: Minimum number of tuple updates or deletes prior to vacuum.
      - string
      - integer
    - `autovacuum_analyze_threshold` union: Minimum number of tuple inserts, updates, or deletes prior to analyze.
      - string
      - integer
    - `autovacuum_vacuum_insert_threshold` union: Minimum number of tuple inserts prior to vacuum, or -1 to disable insert vacuums.
      - string
      - integer
    - `autovacuum_freeze_max_age` union: Age at which to autovacuum a table to prevent transaction ID wraparound.
      - string
      - integer
    - `autovacuum_vacuum_cost_limit` union: Cost-accounting limit shared across all autovacuum workers before they pause. Use -1 to inherit vacuum_cost_limit.
      - string
      - integer
    - `autovacuum_vacuum_cost_delay` union: Time autovacuum sleeps when the cost limit is reached. Lower values speed up vacuuming at the cost of more I/O.
      - string
      - integer
    - `vacuum_cost_delay` union: Time in milliseconds a manual VACUUM sleeps when its cost limit is exceeded. 0 disables cost-based delay.
      - string
      - integer
    - `log_min_duration_statement` union: Logs statements that run at least this many milliseconds. 0 logs all statements; -1 disables.
      - string
      - integer
    - `log_temp_files` union: Logs temporary files of at least this size in kilobytes. 0 logs all temporary files; -1 disables.
      - string
      - integer
    - `log_lock_waits` 'on' | 'off': Logs a message when a session waits longer than deadlock_timeout to acquire a lock.
    - `log_parameter_max_length` union: Maximum bytes of each bind parameter value logged with statements. 0 disables; -1 logs values in full.
      - string
      - integer
    - `track_activity_query_size` union: Bytes reserved to store the text of the currently running command of each session, shown in pg_stat_activity.
      - string
      - integer
  - `pgBouncerConfig` PgBouncerConfig, required: PgBouncer [runtime configuration](https://www.pgbouncer.org/config.html) configuration.

## Response `200`

Successful response

- object
  - `status` number: HTTP status code.
  - `requestId` string, uuid: Unique id assigned to every request. UUIDv4
  - `result` PostgresInstanceUpdateConfigResponse
    - `pgConfig` PgConfig, required: Postgres [runtime configuration](https://www.postgresql.org/docs/current/runtime-config.html) configuration.
      - `max_connections` union: Sets the maximum number of concurrent connections to the database server.
        - string
        - integer
      - `default_transaction_isolation` 'read committed' | 'repeatable read' | 'serializable': Sets the default transaction isolation level for new transactions.
      - `ssl_min_protocol_version` 'TLSv1' | 'TLSv1.1' | 'TLSv1.2' | 'TLSv1.3': Sets the minimum SSL/TLS protocol version allowed for client connections.
      - `default_toast_compression` 'pglz' | 'lz4': Sets the default compression method for compressible values stored out of line (TOAST).
      - `maintenance_work_mem` union: Sets the maximum memory to be used for maintenance operations.
        - string
        - integer
      - `work_mem` union: Sets the amount of memory Postgres will use for internal operations like sorting and hashing as part of executing a query.
        - string
        - integer
      - `effective_cache_size` union: Sets the planner's assumption about the total size of data caches.
        - string
        - integer
      - `random_page_cost` union: Sets the planner's estimate of the cost of a non-sequentially-fetched disk page. Lower values (1.1-1.5) are better for SSDs.
        - string
        - number
      - `effective_io_concurrency` union: Number of concurrent disk I/O operations the planner expects. Higher values (100-200) benefit SSDs.
        - string
        - integer
      - `max_worker_processes` union: Maximum number of background processes the system can support. Includes parallel query workers, logical replication, and more.
        - string
        - integer
      - `max_parallel_workers` union: Maximum number of workers that can be used for parallel operations. Cannot exceed max_worker_processes.
        - string
        - integer
      - `max_parallel_workers_per_gather` union: Maximum number of parallel workers per executor node for parallel queries. Use 0 to disable parallel queries.
        - string
        - integer
      - `max_parallel_maintenance_workers` union: Maximum number of parallel workers for maintenance operations like CREATE INDEX and VACUUM.
        - string
        - integer
      - `shared_memory_percent` union: Percent of VM memory reserved for the shared_memory, from 25% to 75%. shared_buffers sized to fit in it. Limited to 50% on VMs with memory less or equal 16GB
        - string
        - integer
      - `temp_buffers` union: Sets the maximum memory each session uses for temporary table buffers.
        - string
        - integer
      - `hash_mem_multiplier` union: Multiple of work_mem that hash-based operations may use.
        - string
        - integer
      - `enable_parallel_hash` 'on' | 'off': Enables the planner's use of parallel hash plans.
      - `maintenance_io_concurrency` union: Number of concurrent disk I/O operations used for maintenance work such as vacuum.
        - string
        - integer
      - `io_method` 'sync' | 'worker' | 'io_uring': Selects the method used to perform asynchronous I/O. Postgres 18 and later.
      - `io_workers` union: Number of I/O worker processes used when io_method is worker. Postgres 18 only.
        - string
        - integer
      - `io_min_workers` union: Minimum number of I/O worker processes kept running when io_method is worker. Postgres 19 and later.
        - string
        - integer
      - `io_max_workers` union: Maximum number of I/O worker processes started when io_method is worker. Postgres 19 and later.
        - string
        - integer
      - `bgwriter_delay` union: Sleep time between background writer activity rounds.
        - string
        - integer
      - `bgwriter_flush_after` union: Amount of data written by the background writer after which the OS is asked to flush it to disk.
        - string
        - integer
      - `bgwriter_lru_maxpages` union: Maximum number of buffers the background writer writes per round.
        - string
        - integer
      - `bgwriter_lru_multiplier` union: Multiple of the average recent buffer demand that the background writer cleans per round.
        - string
        - integer
      - `statement_timeout` union: Abort any statement that runs longer than the specified time. Use 0 to disable.
        - string
        - integer
      - `lock_timeout` union: Abort any statement that waits longer than the specified time while attempting to acquire a lock. Use 0 to disable.
        - string
        - integer
      - `idle_session_timeout` union: Terminate any session that has been idle for longer than the specified time. Use 0 to disable.
        - string
        - integer
      - `idle_in_transaction_session_timeout` union: Terminate any session that has been idle within an open transaction for longer than the specified time. Use 0 to disable.
        - string
        - integer
      - `transaction_timeout` union: Terminate any statement that takes more than the specified time, even while active. Use 0 to disable.
        - string
        - integer
      - `wal_sender_timeout` union: Terminate replication connections that are inactive for longer than this time. Use 0 to disable.
        - string
        - integer
      - `wal_keep_size` union: Minimum size of past WAL files kept in pg_wal for standby servers. Use 0 to disable.
        - string
        - integer
      - `min_wal_size` union: Minimum size to shrink the WAL to. WAL files are recycled rather than removed when below this size.
        - string
        - integer
      - `max_wal_size` union: Maximum size WAL can grow between checkpoints. Larger values improve write performance but increase crash recovery time.
        - string
        - integer
      - `checkpoint_timeout` union: Sets the maximum time between automatic WAL checkpoints.
        - string
        - integer
      - `max_slot_wal_keep_size` union: Specifies the maximum size of WAL files that replication slots are allowed to retain. Use -1 for unlimited.
        - string
        - integer
      - `wal_compression` 'off' | 'on' | 'lz4' | 'zstd': Compress full-page writes in WAL. Reduces I/O at the cost of CPU. Options vary by PostgreSQL version.
      - `wal_buffers` union: Sets the number of disk-page buffers in shared memory for WAL. A number without a unit is in 8 kB pages.
        - string
        - integer
      - `max_replication_slots` union: Maximum number of replication slots. Standbys and logical replication each use slots.
        - string
        - integer
      - `max_wal_senders` union: Maximum number of simultaneously running WAL sender processes.
        - string
        - integer
      - `max_logical_replication_workers` union: Maximum number of logical replication workers for subscriptions on this server.
        - string
        - integer
      - `max_repack_replication_slots` union: Replication slots reserved for REPACK CONCURRENTLY, separate from max_replication_slots. Postgres 19 and later.
        - string
        - integer
      - `max_sync_workers_per_subscription` union: Maximum number of table synchronization workers per subscription.
        - string
        - integer
      - `logical_decoding_work_mem` union: Maximum memory used for logical decoding before changes spill to disk.
        - string
        - integer
      - `autovacuum_max_workers` union: Maximum number of autovacuum worker processes that can run at the same time. Workers share a single cost-limit budget, so raising this alone may not speed up vacuuming.
        - string
        - integer
      - `autovacuum_max_parallel_workers` union: Maximum number of parallel workers a single autovacuum worker can use. 0 (the default) turns parallel autovacuum off. Postgres 19 and later.
        - string
        - integer
      - `autovacuum_naptime` union: Minimum delay between autovacuum runs. Lower values make autovacuum check for work more frequently.
        - string
        - integer
      - `autovacuum_work_mem` union: Maximum memory each autovacuum worker uses to track dead tuples. Higher values reduce repeated index-vacuum passes on large tables. Use -1 to fall back to maintenance_work_mem.
        - string
        - integer
      - `autovacuum_vacuum_scale_factor` union: Fraction of a table's rows that must change before autovacuum runs. Lower values vacuum large tables more frequently.
        - string
        - number
      - `autovacuum_analyze_scale_factor` union: Fraction of a table's rows that must change before autovacuum runs ANALYZE to refresh planner statistics.
        - string
        - number
      - `autovacuum_vacuum_insert_scale_factor` union: Fraction of a table's rows that must be inserted before autovacuum runs. Helps vacuum insert-heavy, rarely-updated tables.
        - string
        - number
      - `autovacuum_vacuum_threshold` union: Minimum number of tuple updates or deletes prior to vacuum.
        - string
        - integer
      - `autovacuum_analyze_threshold` union: Minimum number of tuple inserts, updates, or deletes prior to analyze.
        - string
        - integer
      - `autovacuum_vacuum_insert_threshold` union: Minimum number of tuple inserts prior to vacuum, or -1 to disable insert vacuums.
        - string
        - integer
      - `autovacuum_freeze_max_age` union: Age at which to autovacuum a table to prevent transaction ID wraparound.
        - string
        - integer
      - `autovacuum_vacuum_cost_limit` union: Cost-accounting limit shared across all autovacuum workers before they pause. Use -1 to inherit vacuum_cost_limit.
        - string
        - integer
      - `autovacuum_vacuum_cost_delay` union: Time autovacuum sleeps when the cost limit is reached. Lower values speed up vacuuming at the cost of more I/O.
        - string
        - integer
      - `vacuum_cost_delay` union: Time in milliseconds a manual VACUUM sleeps when its cost limit is exceeded. 0 disables cost-based delay.
        - string
        - integer
      - `log_min_duration_statement` union: Logs statements that run at least this many milliseconds. 0 logs all statements; -1 disables.
        - string
        - integer
      - `log_temp_files` union: Logs temporary files of at least this size in kilobytes. 0 logs all temporary files; -1 disables.
        - string
        - integer
      - `log_lock_waits` 'on' | 'off': Logs a message when a session waits longer than deadlock_timeout to acquire a lock.
      - `log_parameter_max_length` union: Maximum bytes of each bind parameter value logged with statements. 0 disables; -1 logs values in full.
        - string
        - integer
      - `track_activity_query_size` union: Bytes reserved to store the text of the currently running command of each session, shown in pg_stat_activity.
        - string
        - integer
    - `pgBouncerConfig` PgBouncerConfig, required: PgBouncer [runtime configuration](https://www.pgbouncer.org/config.html) configuration.
    - `message` string: Informational message about the configuration update, such as restart requirements.

## Other responses

- `400`: The request cannot be processed due to a client error. Please verify your request parameters and try again.
- `500`: An internal server error has occurred. If this issue persists, please contact ClickHouse Cloud support for assistance.

## Changes

- **2026-11-18** `ff61bd2824e0`: 8 info
  - added the new optional request property `pgConfig/autovacuum_max_parallel_workers`
  - added the new optional request property `pgConfig/io_max_workers`
  - added the new optional request property `pgConfig/io_min_workers`
  - added the new optional request property `pgConfig/max_repack_replication_slots`
  - …4 more
- **2026-10-21** `3926938961fc`: 44 info
  - added the new optional request property `pgConfig/bgwriter_delay`
  - added the new optional request property `pgConfig/bgwriter_flush_after`
  - added the new optional request property `pgConfig/bgwriter_lru_maxpages`
  - added the new optional request property `pgConfig/bgwriter_lru_multiplier`
  - …40 more
- **2026-10-15** `15a4aadb089d`: 14 info
  - added the new optional request property `pgConfig/autovacuum_analyze_threshold`
  - added the new optional request property `pgConfig/autovacuum_freeze_max_age`
  - added the new optional request property `pgConfig/autovacuum_vacuum_insert_threshold`
  - added the new optional request property `pgConfig/autovacuum_vacuum_threshold`
  - …10 more

[Operation history](https://skmtc.dev/clickhouse/apis/openapi-spec-for-clickhouse-cloud/changes/v1/organizations/:organizationId/postgres/:postgresId/config/post.md)

---

[API](https://skmtc.dev/clickhouse/apis/openapi-spec-for-clickhouse-cloud.md) - [All operations](https://skmtc.dev/clickhouse/apis/openapi-spec-for-clickhouse-cloud/llms.txt) - [OpenAPI document](https://skmtc.dev/clickhouse/apis/openapi-spec-for-clickhouse-cloud/revisions/eac345053548?raw)
