# Use a connection pooler > Turn on the Orchard connection pooler for a managed Postgres database so that apps share a small set of server connections. Source: https://docs.orchard.hackclub.com/data/connection-pooler/ Each Postgres connection uses memory on the database server, so a database can serve only a limited number of them. A connection pooler accepts many client connections and shares a small set of Postgres server connections between them. Use a pooler when an app opens more connections than the database can serve. Orchard runs the pooler with PgBouncer. New databases with 1 GB of memory or less start with a pooler. A superadmin can change this default in **Instance admin** > **Configuration** > **Connection pooler for new small databases**. ## Prerequisites - Edit access to the project: the Admin or Member [project role](/teams/organizations/#project-roles). - A dedicated database. ## Turn on the pooler **Dashboard** 1. Open the database. 2. Go to **Settings** > **Connection pooler**. 3. Turn on **Pool connections**. The **Address** row shows the pooler address and its status. Wait for the status to change from **Starting** to **Running**. **CLI** ```sh orchard db pooler set --enabled on ``` To read the pooler address and status, run the following command: ```sh orchard db pooler get ``` ## Connect an app to the pooler Turning on the pooler does not change the database connection string. Apps keep connecting directly to Postgres until you change them. 1. Copy the address from the **Address** row. The address has this format: ```txt pg--pooler-rw..svc.cluster.local:5432 ``` 2. Open the app. 3. Go to **Variables**. 4. Set the connection string [variable](/run/environments/) to a value that uses the pooler address as the host. Keep the same user, password, and database name. 5. Select **Save**. The pooler address works only inside the cluster. ## Change the pooler settings **Dashboard** 1. Open the database. 2. Go to **Settings** > **Connection pooler**. 3. Update the settings. 4. Select **Save**. **CLI** ```sh orchard db pooler set --mode session --pool-size 20 --max-client-conn 1000 ``` Clients reconnect once when the pooler restarts. | Setting | CLI flag | Default | Range | Description | | -------------------------- | ------------------- | ------------- | ------------------------ | ------------------------------------------------------ | | **Mode** | `--mode` | `transaction` | `transaction`, `session` | How the pooler assigns server connections. | | **Pool size** | `--pool-size` | 10 | 1 to 100 | Server connections for each database and user. | | **Max client connections** | `--max-client-conn` | 500 | 10 to 5000 | Clients the pooler accepts before it refuses new ones. | | Not in the dashboard | `--instances` | 1 | 1 to 3 | Pooler instances. | Two modes are available: - **Transaction:** The pooler assigns a server connection for each transaction. This mode fits most apps. - **Session:** The pooler assigns a server connection for each client. Use this mode if the app uses `LISTEN` or session settings. ## Turn off the pooler 1. Open the database. 2. Go to **Settings** > **Connection pooler**. 3. Turn off **Pool connections**. Orchard deletes the pooler. Connections that use its address fail, so point all apps back to the database host first. ## Related resources - [Change Postgres parameters](/data/parameters/) - Raise `max_connections` when a pooler is not an option. - [`orchard db pooler` reference](/reference/cli/#db) - Review the pooler commands and their flags.