---
title: "Does Cloud SQL Managed Connection Pooling change a Cloud Run service's connection budget? | Proofline"
description: "Yes, if the instance qualifies: PostgreSQL then sees at most poolers × max_pool_size server connections per database and user, however many clients connect."
url: https://proofline.sh/learn/cloud-sql-managed-connection-pooling-cloud-run/
---

[Learning center](/learn/)

# Does Cloud SQL Managed Connection Pooling change a Cloud Run service's connection budget?

Yes, if the instance qualifies: PostgreSQL then sees at most poolers × max\_pool\_size server connections per database and user, however many clients connect. Cloud Run's connections count against each pooler's client limit instead. It requires Enterprise Plus, and its default transaction mode drops session features some applications rely on.

Capacity overruns The Proofline team November 23, 2026 6 min read

## What the pooler changes

Without a pooler, every connection a Cloud Run instance opens is a PostgreSQL backend, and a full table refuses new ones at the admission stage of [the four stages](/learn/cloud-run-cloud-sql-connection-errors/#stage), so the [connection budget](/learn/cloud-run-cloud-sql-connection-budget/) is instances times pool size against `max_connections`. With Managed Connection Pooling enabled, clients connect to a cluster of connection poolers instead. Each pooler keeps a pool of server connections for each database and user pair and hands an idle one to a client that needs it. If none is idle and the pool is below `max_pool_size`, it opens another; if the pool is full, the client waits. In the default transaction mode, the server connection returns to the pool when each transaction completes. Cloud SQL names serverless applications on Cloud Run, which open many short-lived connections, as a workload where PostgreSQL's per-connection overhead affects performance, and says the pooler helps short-lived connections and connection surges most. [Managed Connection Pooling overview](https://cloud.google.com/sql/docs/postgres/managed-connection-pooling)

The budget becomes two budgets:

| Side | Limit | Default |
| --- | --- | --- |
| Client connections from Cloud Run | `max_client_connections` per pooler | 5,000 per pooler |
| Server connections to PostgreSQL | `max_pool_size` per database and user pair, per pooler | 50 |
| Number of poolers | vCPUs divided by 4, at least 1 | 2 poolers at 8 vCPUs |
| Wait for a server connection | `query_wait_timeout` | 120 seconds |

Settings apply per pooler, so an 8-vCPU instance with the default `max_pool_size` can open up to 100 server connections for one database and user. `max_connections` still caps the server connections, and Cloud SQL recommends reserving at least 15 server connections per vCPU for the poolers when you use the default pool size. [Configuration options and server connections](https://cloud.google.com/sql/docs/postgres/managed-connection-pooling)

Cloud Run's own limit stays in place: with the built-in Cloud SQL connection, an instance can have at most 100 connections to a Cloud SQL database. [Cloud Run limits](https://cloud.google.com/sql/docs/quotas)

## Check 1: does the instance qualify?

```
gcloud sql instances describe INSTANCE \
  --project PROJECT \
  --format='yaml(settings.edition, settings.tier, settings.connectionPoolConfig, settings.databaseFlags)'
```

`settings.edition` reads `ENTERPRISE` or `ENTERPRISE_PLUS`, and `settings.connectionPoolConfig.connectionPoolingEnabled` says whether pooling is on, with any pool flags under `flags`. [Instance resource](https://cloud.google.com/sql/docs/postgres/admin-api/rest/v1/instances)

Cloud SQL lists these requirements:

-   The instance is a Cloud SQL Enterprise Plus edition instance.
-   Clients connect directly or through the Cloud SQL Auth Proxy, version 2.15.2 or later.
-   The instance uses private services access, public IP or Private Service Connect, and the new Cloud SQL network architecture.
-   The instance runs at least maintenance version `POSTGRES_$version.R20250727.00_14`.

[Requirements and limitations](https://cloud.google.com/sql/docs/postgres/managed-connection-pooling)

Cloud Run's documentation does not say which Auth Proxy version its built-in connection runs, so the documentation alone does not show whether the built-in `/cloudsql/` socket meets the second requirement. Test it on a revision with a tag and no traffic before moving production traffic. The pooler listens on port 6432 for direct connections and on 3307 for connections through the Auth Proxy; PostgreSQL itself stays on 5432. [Ports](https://cloud.google.com/sql/docs/postgres/managed-connection-pooling) · [Test with a tag](/learn/test-previous-cloud-run-revision-with-tag/)

An instance on the Enterprise edition cannot use it. Its budget stays the client-side arithmetic.

## Check 2: does the application need session state?

In transaction mode, consecutive transactions from one client may run on different server connections, and Cloud SQL lists SQL features that are not supported:

-   `SET` and `RESET`
-   `LISTEN`
-   `WITH HOLD` cursors
-   `PREPARE` and `DEALLOCATE`
-   temporary tables with `PRESERVE` or `DELETE ROWS`
-   `LOAD`
-   session-level advisory locks

Protocol-level named prepared statements, which many drivers create on their own, work only if `max_prepared_statements` is above its default of 0; Cloud SQL calls this out for asyncpg on ports 6432 and 3307. Session mode keeps a dedicated server connection per client session, which preserves session state and gives up most of the pooling. Client IP tracking is not supported, so query insights shows client addresses as local. [Pooling options and limitations](https://cloud.google.com/sql/docs/postgres/managed-connection-pooling)

Search the code and its libraries for those statements, and for drivers that prepare statements automatically. A client that needs them can keep connecting to PostgreSQL on 5432 while the rest of the service uses the pooler.

## Check 3: compute both budgets

```
client side:  Σ revisions (max instances × pool per instance)  ≤  poolers × max_client_connections
server side:  poolers × max_pool_size  (per database and user pair)
              + direct clients on 5432
              ≤  max_connections − reserved slots
```

| Result | Reading |
| --- | --- |
| Server side fits, client side fits | The pooler absorbs scale-out that would exceed `max_connections` without it. Concurrent transactions above the server-side pools wait, up to `query_wait_timeout` |
| Server side exceeds `max_connections` | Lower `max_pool_size` or raise `max_connections`, following the 15-per-vCPU recommendation |
| The service holds long-lived connections and few short ones | Cloud SQL notes that long-lived connections may perform slightly worse through the pooler; the client-side pool may already be enough |

Enabling pooling on an existing instance restarts the database. The following command makes that change: [Configure Managed Connection Pooling](https://cloud.google.com/sql/docs/postgres/configure-mcp) · [`gcloud sql instances patch`](https://cloud.google.com/sdk/gcloud/reference/sql/instances/patch)

```
gcloud sql instances patch INSTANCE --project PROJECT --enable-connection-pooling
```

## A worked fixture: two databases

The fixture is illustrative.

**`ledger-db` on Enterprise Plus.** The instance has 8 vCPUs, so it runs 2 poolers, and `max_connections` is 400. `orders-api` runs up to 60 instances with a pool of 10 each: 600 client connections, against a client limit of 2 × 5,000. Without the pooler, 600 would be far over 397 usable slots; with it, the server side for `orders_app` on database `orders` is at most 2 × 50 = 100 connections. `orders-worker` connects directly with 16 and the analysts with 6, so the server total stays at or below 122. Of the 397 usable slots, 375 remain beside the direct clients, more than the recommended 15 × 8 = 120 for the poolers.

The code check finds `LISTEN` in `orders-worker`, which waits for notifications on one connection, and nothing on the list in `orders-api`. The worker keeps connecting to port 5432. `orders-api` moves to the pooler in a tagged revision first. When concurrent transactions exceed 100 at peak, they wait for a server connection instead of failing with SQLSTATE `53300`, and the team watches transaction latency for that wait.

**`reports-db` on Enterprise.** `settings.edition` reads `ENTERPRISE`. Managed Connection Pooling is not available for it, and `reports-api`'s budget stays the client-side arithmetic: its maximum instances, its pool size and `max_connections`.

## Where the checks mislead

The pooler changes what `pg_stat_activity` shows. Sessions come from poolers, and Cloud SQL does not say whether `application_name` passes through; check before relying on [grouping sessions by revision](/learn/which-cloud-run-revision-holds-cloud-sql-connections/).

A client limit of 5,000 per pooler is a ceiling on connections, not on throughput. With 600 clients and 100 server connections, the transaction rate decides how long clients wait, and a slow query holds a server connection for its whole transaction.

Availability, versions and limits change. Read the overview's requirements and limitations again before planning on this page's figures.

## Questions

### Is Cloud SQL Managed Connection Pooling available for every PostgreSQL instance?

No. Cloud SQL requires an Enterprise Plus edition instance on the new network architecture, a minimum maintenance version, and clients that connect directly or through the Cloud SQL Auth Proxy 2.15.2 or later.

### Does Managed Connection Pooling support prepared statements?

In transaction mode, SQL-level `PREPARE` and `DEALLOCATE` are not supported. Protocol-level named prepared statements work when `max_prepared_statements` is set above its default of 0.

### Does Managed Connection Pooling remove the Cloud Run limit of 100 connections per instance?

Cloud SQL's documentation does not say so. The limit applies to Cloud Run's built-in Cloud SQL connection, and the pooler sits on the database side of it.

## One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. [Eligibility and fair-use terms](/free-code-review/).

[Start free with GitHub](https://proofline.sh/orgs/plan?offer=free_month)

## Related reading

-   ### [How many Cloud SQL connections can a Cloud Run service open?](/learn/cloud-run-cloud-sql-connection-budget/)
    
    Capacity overruns The Proofline team November 23, 2026 7 min read
    
-   ### [What max\_connections does this Cloud SQL for PostgreSQL instance have?](/learn/cloud-sql-postgres-default-max-connections/)
    
    Capacity overruns The Proofline team November 23, 2026 6 min read
