v8

latestOpenAPI 3.0.0Apache 2.0raw.githubusercontent.com2025-10-165266542.4 MB
DigitalOcean-public.v2-new_Databases

Add a New Connection Pool (PostgreSQL)

For PostgreSQL database clusters, connection pools can be used to allow a database to share its idle connections. The popular PostgreSQL connection pooling utility PgBouncer is used to provide this service. See here for more information about how and why to use PgBouncer connection pooling including details about the available transaction modes.

To add a new connection pool to a PostgreSQL database cluster, send a POST request to /v2/databases/$DATABASE_ID/pools specifying a name for the pool, the user to connect with, the database to connect to, as well as its desired size and transaction mode.

post/v2/databases/{database_cluster_uuid}/pools

Path parameters

database_cluster_uuidstring uuid required

A unique identifier for a database cluster.

Request body

namestring required

A unique name for the connection pool. Must be between 3 and 60 characters.

modestring required

The PGBouncer transaction mode for the connection pool. The allowed values are session, transaction, and statement.

sizeinteger required

The desired size of the PGBouncer connection pool. The maximum allowed size is determined by the size of the cluster's primary node. 25 backend server connections are allowed for every 1GB of RAM. Three are reserved for maintenance. For example, a primary node with 1 GB of RAM allows for a maximum of 22 backend server connections while one with 4 GB would allow for 97. Note that these are shared across all connection pools in a cluster.

dbstring required

The database for use with the connection pool.

userstring

The name of the user for use with the connection pool. When excluded, all sessions connect to the database as the inbound user.

Example request

{
  "name": "backend-pool",
  "mode": "transaction",
  "size": 10,
  "db": "defaultdb",
  "user": "doadmin",
  "connection": {
    "uri": "postgres://doadmin:wv78n3zpz42xezdk@backend-do-user-19081923-0.db.ondigitalocean.com:25060/defaultdb?sslmode=require",
    "database": "defaultdb",
    "host": "backend-do-user-19081923-0.db.ondigitalocean.com",
    "port": 25060,
    "user": "doadmin",
    "password": "wv78n3zpz42xezdk",
    "ssl": true
  },
  "private_connection": {
    "uri": "postgres://doadmin:wv78n3zpz42xezdk@backend-do-user-19081923-0.db.ondigitalocean.com:25060/defaultdb?sslmode=require",
    "database": "defaultdb",
    "host": "backend-do-user-19081923-0.db.ondigitalocean.com",
    "port": 25060,
    "user": "doadmin",
    "password": "wv78n3zpz42xezdk",
    "ssl": true
  },
  "standby_connection": {
    "uri": "postgres://doadmin:wv78n3zpz42xezdk@backend-do-user-19081923-0.db.ondigitalocean.com:25060/defaultdb?sslmode=require",
    "database": "defaultdb",
    "host": "backend-do-user-19081923-0.db.ondigitalocean.com",
    "port": 25060,
    "user": "doadmin",
    "password": "wv78n3zpz42xezdk",
    "ssl": true
  },
  "standby_private_connection": {
    "uri": "postgres://doadmin:wv78n3zpz42xezdk@backend-do-user-19081923-0.db.ondigitalocean.com:25060/defaultdb?sslmode=require",
    "database": "defaultdb",
    "host": "backend-do-user-19081923-0.db.ondigitalocean.com",
    "port": 25060,
    "user": "doadmin",
    "password": "wv78n3zpz42xezdk",
    "ssl": true
  }
}

Response

A JSON object with a key of pool.

Example response

{
  "pool": {
    "name": "backend-pool",
    "mode": "transaction",
    "size": 10,
    "db": "defaultdb",
    "user": "doadmin",
    "connection": {
      "uri": "postgres://doadmin:wv78n3zpz42xezdk@backend-do-user-19081923-0.db.ondigitalocean.com:25060/defaultdb?sslmode=require",
      "database": "defaultdb",
      "host": "backend-do-user-19081923-0.db.ondigitalocean.com",
      "port": 25060,
      "user": "doadmin",
      "password": "wv78n3zpz42xezdk",
      "ssl": true
    },
    "private_connection": {
      "uri": "postgres://doadmin:wv78n3zpz42xezdk@backend-do-user-19081923-0.db.ondigitalocean.com:25060/defaultdb?sslmode=require",
      "database": "defaultdb",
      "host": "backend-do-user-19081923-0.db.ondigitalocean.com",
      "port": 25060,
      "user": "doadmin",
      "password": "wv78n3zpz42xezdk",
      "ssl": true
    },
    "standby_connection": {
      "uri": "postgres://doadmin:wv78n3zpz42xezdk@backend-do-user-19081923-0.db.ondigitalocean.com:25060/defaultdb?sslmode=require",
      "database": "defaultdb",
      "host": "backend-do-user-19081923-0.db.ondigitalocean.com",
      "port": 25060,
      "user": "doadmin",
      "password": "wv78n3zpz42xezdk",
      "ssl": true
    },
    "standby_private_connection": {
      "uri": "postgres://doadmin:wv78n3zpz42xezdk@backend-do-user-19081923-0.db.ondigitalocean.com:25060/defaultdb?sslmode=require",
      "database": "defaultdb",
      "host": "backend-do-user-19081923-0.db.ondigitalocean.com",
      "port": 25060,
      "user": "doadmin",
      "password": "wv78n3zpz42xezdk",
      "ssl": true
    }
  }
}