> ## Documentation Index
> Fetch the complete documentation index at: https://www.paradedb.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Tune ParadeDB

> Tune PostgreSQL settings for better read and write performance

ParadeDB uses Postgres' settings, which can be found in the `postgresql.conf` file. To find your `postgresql.conf` file, use `SHOW`.

```sql theme={null}
SHOW config_file;
```

These settings can be changed in several ways:

1. By editing the `postgresql.conf` file and restarting Postgres. This makes the setting permanent for all sessions. `postgresql.conf`
   accepts ParadeDB's custom `paradedb.*` settings.
2. By running `SET`. This temporarily changes the setting for the current session. Note that Postgres does not allow all `postgresql.conf` settings to be changed with `SET`. For example:

```sql theme={null}
SET maintenance_work_mem = '8GB'
```

## Docker

When running ParadeDB in Docker, sensible default parameters are automatically configured based on the resources available to the container. For example, running a container with 4 CPUs and 8GB memory will cause the following to be appended to `postgresql.conf`. Be sure to adjust these parameters as you tune your deployment.

```postgresql.conf theme={null}
# Begin ParadeDB tuning recommendations
# Parameters based on auto-detected 4 CPUs and 8192MB RAM
shared_buffers = '2048MB'                     # 25% of RAM, capped at 16GB
effective_cache_size = '6144MB'               # 75% of RAM
maintenance_work_mem = '512MB'                # RAM / 16, capped at 2GB
work_mem = '20MB'                             # (RAM - shared_buffers) / (3 * max_connections), at least 15MB
max_parallel_workers = '20'                   # CPUs * 5
max_worker_processes = '28'                   # max_parallel_workers + 8
max_parallel_workers_per_gather = '2'         # CPUs / 2, at least 1
max_parallel_maintenance_workers = '2'        # CPUs / 2, at least 2, at most 8
# End ParadeDB tuning recommendations
```

To disable auto-tuning, set `PDB_TUNE=false` when you first run the ParadeDB Docker container:

```bash theme={null}
docker run \
    -e POSTGRES_USER=postgres \
    -e POSTGRES_PASSWORD=postgres \
    -e POSTGRES_DB=postgres \
    -p 5432:5432 \
    -e PDB_TUNE=false \
    -d paradedb/paradedb:latest
```

## Kubernetes

If ParadeDB is deployed in Kubernetes with [CloudNativePG](https://www.paradedb.com/docs/operate/deploy/self-hosted/kubernetes.md), configure these settings under `cluster.postgresql.parameters` in your `values.yaml` file. Parameter values must be strings. For example:

```yaml values.yaml theme={null}
cluster:
  postgresql:
    parameters:
      max_worker_processes: "76"
      max_parallel_workers: "64"
      paradedb.global_mutable_segment_rows: "1000"
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.