Connecting to Managed Postgres

[Edit this page](https://github.com/ClickHouse/clickhouse-docs/blob/main/docs/cloud/managed-postgres/connection.md)

[Private preview](https://clickhouse.com/cloud/postgres)

## Accessing connection details[​](#accessing-connection-details "Direct link to Accessing connection details")

To connect your applications to Managed Postgres, navigate to the **Connect** view in the left sidebar of your instance.

Clicking **Connect** opens a modal displaying your connection credentials and connection strings in multiple formats.

The connection modal displays the following information:

- **Username**: The database user (default: `postgres`)
- **Password**: Your database password (masked by default, click the eye icon to reveal)
- **Server**: The hostname for your Managed Postgres instance
- **Port**: The PostgreSQL port (default: `5432`)

Managed Postgres provides superuser access to your database. Use these credentials to connect as a superuser, which allows you to create additional users and manage database objects.

## Connection string formats[​](#connection-string "Direct link to Connection string formats")

The **Connect via** tabs provide your connection string in multiple formats to match your application's requirements:

|  |  |  |  |  |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Format Description|  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | **url** Standard connection URL in the format `postgresql://<USER>:<PASSWORD>@<HOST>:<PORT>/<DATABASE>`| **psql** Ready-to-use command for connecting via the psql command line tool|  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | | **env** Environment variables for libpq-based clients|  |  |  |  | | --- | --- | --- | --- | | **yaml** YAML formatted configuration|  |  | | --- | --- | | **jdbc** JDBC connection string for Java applications | | | | | | | | | | | |

For security reasons, the password in connection strings is masked by default. Click the copy icon next to any field or connection string to copy it directly to your clipboard.

## PgBouncer connection pooling[​](#pgbouncer "Direct link to PgBouncer connection pooling")

Managed Postgres includes a bundled [PgBouncer](https://www.pgbouncer.org/) instance for server-side connection pooling. PgBouncer helps improve connection management, performance, and resource utilization, especially for applications that:

- Open many concurrent connections
- Frequently create and close connections
- Use serverless or ephemeral compute environments

To use connection pooling, click the **via PgBouncer** toggle at the top of the connection modal. The connection details will update to route your connections through the connection pooler instead of directly to PostgreSQL.

When to use PgBouncer

Use PgBouncer when your application opens many short-lived connections. For long-running connections or applications that use PostgreSQL features incompatible with connection pooling (like prepared statements across transactions), connect directly.

Moving data to ClickHouse using ClickPipes isn't supported via PgBouncer.

## TLS configuration[​](#tls "Direct link to TLS configuration")

All Managed Postgres instances are secured with TLS. The minimum supported version is **TLS 1.3**.

### Quick connection (TLS encrypted)[​](#quick-connection "Direct link to Quick connection (TLS encrypted)")

By default, connections use TLS encryption without certificate verification:

```
psql 'postgresql://postgres:[email protected]:5432/postgres'
```

### Verified TLS connection (recommended for production)[​](#verified-tls "Direct link to Verified TLS connection (recommended for production)")

For production workloads, we recommend connecting with verified TLS to ensure you're communicating with the correct server. To do this, download the CA certificate bundle from the **Settings** tab and add it to your database client's trusted certificates.

The CA certificate is unique to your Managed Postgres instance and won't work with other instances.

To connect with a verified TLS connection, add `sslmode=verify-full` and the path to your downloaded certificate:

```
psql 'postgresql://postgres:[email protected]:5432/postgres?sslmode=verify-full&sslrootcert=/path/to/ca-certificate.pem'
```

- [Accessing connection details](#accessing-connection-details)- [Connection string formats](#connection-string)- [PgBouncer connection pooling](#pgbouncer)- [TLS configuration](#tls)
        - [Quick connection (TLS encrypted)](#quick-connection)- [Verified TLS connection (recommended for production)](#verified-tls)

Was this page helpful?