← Files PlanetScaleARCHIVED FILE
skills/database-postgres/references/ps-connections.md
1.58 KB · Oct 4, 2026 · 12:25 UTC
--- title: PlanetScale Postgres Connections description: Connection guide for PlanetScale Postgres tags: planetscale, postgres, connections, ssl, troubleshooting --- # PlanetScale Postgres Connections Postgres docs: https://planetscale.com/docs/postgres/connecting | Protocol | Standard Port | Pooled Port | SSL | | -------- | ------------- | ----------------------- | -------- | | Postgres | 5432 | 6432 (PgBouncer) | Required | Credentials (roles) are branch-specific and cannot be recovered after creation. ## Connection String ``` postgresql://<user>:<password>@<host>.horizon.psdb.cloud:5432/<database>?sslmode=verify-full&sslrootcert=system&sslnegotiation=direct ``` Use port **6432** for PgBouncer (applications/OLTP). Use port **5432** for DDL, admin tasks, and migrations. ## Troubleshooting | Error | Fix | | -------------------------------- | --------------------------------------- | | `password authentication failed` | Check role format: `<role>.<branch_id>` | | `too many clients already` | Use PgBouncer (port 6432) | | `SSL connection is required` | Add `sslmode=verify-full&sslrootcert=system` | **Best practices:** - Use the PlanetScale Postgres metrics page to monitor direct and PgBouncer connections - Route OLTP traffic to port 6432 and reserve 5432 for admin/migrations. - Run maintenance that changes session state (e.g. `SET default_transaction_read_only`) on port 5432 only. On 6432 (PgBouncer transaction pooling) session `SET`s leak into other clients' connections. - Avoid raising `max_connections` reactively instead of pooling.
SHA-256: e166e515a5192ba0eedadffe88f5560f74c6c5c09239d3e5210dec28fa63bc4d