This page describes what Managed Connection Pooling is and how to use it with your
Cloud SQL instances.
Managed Connection Pooling lets you scale your workloads by optimizing resource utilization
and connection latency for your Cloud SQL for PostgreSQL instances using pooling.
Managed Connection Pooling dynamically assigns server connections to
incoming requests when possible. This delivers significant performance
improvements, especially for scaled connections, by absorbing sudden
connection spikes and reusing existing database connections. Instead of
connecting to a particular database, Managed Connection Pooling connects to a
cluster of poolers, which provide shorter connection times and scalability
for your workloads. The number of poolers used is based on the number of vCPU
cores of your instance.
While you can use Managed Connection Pooling for any transactional workloads,
Managed Connection Pooling provides the most throughput and latency benefit with applications
that contain short-lived connections, or applications that result in a
connection surge.
For long-lived connections, the connection performance using
Managed Connection Pooling can be slightly lower than when using a direct
connection. In this case, Managed Connection Pooling provides connection
scaling when the number of connections is very high. However, for
applications that typically establish long-lived connections, you might use
direct connections to your instance instead.
To use Managed Connection Pooling, your instance must meet the following requirements:
Your instance must be a Cloud SQL Enterprise Plus edition instance.
You must be connected to your instance using a direct connection, or
the Cloud SQL Auth Proxy only.
You must be connected to your instance using a valid username
and password. IAM and IAM
group users aren't supported when using Managed Connection Pooling.
Managed Connection Pooling requires a minimum maintenance
version number of POSTGRES_$version.R20250302.00_04. For more
information, see
Perform self-service maintenance.
Ports used by Managed Connection Pooling for Cloud SQL instances
When you enable Managed Connection Pooling, the ports used by Cloud SQL instances to serve database traffic change. The ports used by Managed Connection Pooling are as follows:
TCP port 5432: used for direct connections by the Postgres database server. This is the default port number used when directly connecting using psql client.
TCP port 6432: used for direct connections by the Managed Connection Pooling pooler. To connect using this port, specify psql -p 6432 when directly connecting using psql client.
TCP port 3307: used for the Cloud SQL Auth Proxy only connections by a Managed Connection Pooling pooler. When you use Cloud SQL Auth Proxy to connect to Managed Connection Pooling pooler, this port number is configured with the Cloud SQL Auth Proxy client and can't be changed.
Available configuration options
Managed Connection Pooling offers the following pooling options that you can set
using the pool_mode parameter:
transaction (default): pools connections at a transaction level.
max_pool_size: the maximum size of the connection pool. The default
value is 50 connections.
min_pool_size: the threshold size of the connection pool. If the number
of server connections is less than min_pool_size, then add more server
connections to the pool. The default value is 0 connections.
max_client_connections: the maximum number of connections allowed
for your instance. The default value is 5,000 connections.
client_connection_idle_timeout: the time that a client-connection
remains idle before it times out. This value can range from 0 to 2,147,483
seconds, and the default value is 0 seconds.
server_connection_idle_timeout: the time that a server connection
remains idle before it times out. This value can range from 0 to 2,147,483
seconds, and the default value is 600 seconds.
query_wait_timeout: the time that a query waits until it times out.
This value can range from 0 to 2,147,483 seconds, and the default value is
120 seconds.
max_prepared_statements: the maximum number of protocol-level named
prepared statements commands supported in transaction pooling mode. The
default value is 0 statements.
ignore_startup_parameters: the parameters you want ignored, that
aren't tracked in Managed Connection Pooling's startup packets by default.
server_lifetime: the maximum time a server connection is unused
before Managed Connection Pooling closes it. The default value is 3600 seconds.
Limitations
Consider the following limitations when using Managed Connection Pooling with
your Cloud SQL Enterprise Plus edition instances:
Enabling Managed Connection Pooling on an existing instance results
in a database restart.
When you use the Cloud SQL API to enable, disable, or configure
Managed Connection Pooling, the instance.update API can't contain any other
instance configuration updates.
Managed Connection Pooling can only be used with Cloud SQL Auth Proxy version 2.15.2 and later.
If you're using the Cloud SQL Go Language Connector, then we recommend
a minimum Go version of 1.24. If you use Go version 1.23 or earlier, then
you might experience limitations on performance when using Managed Connection Pooling.
If you're using Managed Connection Pooling in transaction pooling mode, then
the following SQL features aren't supported:
SET/RESET
LISTEN
WITH HOLD CURSOR
PREPARE/DEALLOCATE
PRESERVE/DELETE ROW temp tables
LOAD
Session-level advisory locks
If you're using the
asyncpg database interface library
for Managed Connection Pooling pooler on port 3307 and 6432, then you must update the
max_prepared_statements to a value larger than 0 to enable support for
prepared statements in Managed Connection Pooling pooler.
If you're using Cloud SQL for PostgreSQL version 17, then the
sslnegotiation=direct option isn't supported.
Client IP tracking isn't supported with Managed Connection Pooling. If you enable
store client IP addresses in query insights,
then client IP addresses are displayed as local instead of the IP address
itself.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[],[],null,["# Managed Connection Pooling overview\n\n\u003cbr /\u003e\n\n[MySQL](/sql/docs/mysql/managed-connection-pooling \"View this page for the MySQL database engine\") \\| PostgreSQL \\| SQL Server\n\n\u003cbr /\u003e\n\n|\n| **Preview\n| --- [Managed Connection Pooling](/sql/docs/postgres/managed-connection-pooling)**\n|\n|\n| This feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| You can process personal data for this feature as outlined in the\n| [Cloud Data Processing\n| Addendum](/terms/data-processing-addendum), subject to the obligations and restrictions described in the agreement under\n| which you access Google Cloud.\n|\n| Pre-GA features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nThis page describes what Managed Connection Pooling is and how to use it with your\nCloud SQL instances.\n\nManaged Connection Pooling lets you scale your workloads by optimizing resource utilization\nand connection latency for your Cloud SQL for PostgreSQL instances using pooling.\n\nManaged Connection Pooling dynamically assigns server connections to\nincoming requests when possible. This delivers significant performance\nimprovements, especially for scaled connections, by absorbing sudden\nconnection spikes and reusing existing database connections. Instead of\nconnecting to a particular database, Managed Connection Pooling connects to a\ncluster of poolers, which provide shorter connection times and scalability\nfor your workloads. The number of poolers used is based on the number of vCPU\ncores of your instance.\n\n\nWhile you can use Managed Connection Pooling for any transactional workloads,\nManaged Connection Pooling provides the most throughput and latency benefit with applications\nthat contain short-lived connections, or applications that result in a\nconnection surge.\n\nFor long-lived connections, the connection performance using\nManaged Connection Pooling can be slightly lower than when using a direct\nconnection. In this case, Managed Connection Pooling provides connection\nscaling when the number of connections is very high. However, for\napplications that typically establish long-lived connections, you might use\ndirect connections to your instance instead.\n\nFor more information on how to enable Managed Connection Pooling, see\n[Configure Managed Connection Pooling](/sql/docs/postgres/configure-mcp).\n\nRequirements\n------------\n\nTo use Managed Connection Pooling, your instance must meet the following requirements:\n\n- Your instance must be a Cloud SQL Enterprise Plus edition instance.\n- You must be connected to your instance using a direct connection, or the Cloud SQL Auth Proxy only.\n- You must be connected to your instance using a valid username and password. IAM and IAM group users aren't supported when using Managed Connection Pooling.\n- Your instance must either be set up for [private service access](/sql/docs/postgres/private-ip#set_up_private_services_access_for_your_network), use public IP, or be a new instance with [Private Service Connect](/sql/docs/postgres/about-private-service-connect) enabled.\n- Your instance must use the new [Cloud SQL network architecture](/sql/docs/postgres/upgrade-cloud-sql-instance-new-network-architecture).\n- Managed Connection Pooling requires a minimum maintenance version number of `POSTGRES_$version.R20250302.00_04`. For more information, see [Perform self-service maintenance](/sql/docs/postgres/self-service-maintenance).\n\nPorts used by Managed Connection Pooling for Cloud SQL instances\n----------------------------------------------------------------\n\nWhen you enable Managed Connection Pooling, the ports used by Cloud SQL instances to serve database traffic change. The ports used by Managed Connection Pooling are as follows:\n\n- **TCP port 5432** : used for direct connections by the Postgres database server. This is the default port number used when [directly connecting using psql client](/sql/docs/postgres/connect-admin-ip#connect).\n- **TCP port 6432** : used for direct connections by the Managed Connection Pooling pooler. To connect using this port, specify `psql -p 6432` when [directly connecting using psql client](/sql/docs/postgres/connect-admin-ip#connect).\n- **TCP port 3307**: used for the Cloud SQL Auth Proxy only connections by a Managed Connection Pooling pooler. When you use Cloud SQL Auth Proxy to connect to Managed Connection Pooling pooler, this port number is configured with the Cloud SQL Auth Proxy client and can't be changed.\n\nAvailable configuration options\n-------------------------------\n\nManaged Connection Pooling offers the following pooling options that you can set using the `pool_mode` parameter:\n\n\u003cbr /\u003e\n\n- `transaction` (default): pools connections at a transaction level.\n- `session`: pools connections at a session level.\n\n| **Note:** The maximum number of server connections used by the pooler in Managed Connection Pooling is limited by the `max_connections` database configuration. Cloud SQL recommends adjusting this value based on your instance's workload requirements and the database instance size. For more information about the `max_connections` flag, see [Maximum concurrent connections](/sql/docs/quotas#maximum_concurrent_connections). To modify the `max_connections` database configuration flag for your instance, see [Configure database flags](/sql/docs/postgres/flags#config).\n\nYou can also\n[customize Managed Connection Pooling](/sql/docs/postgres/configure-mcp#modify-mcp)\nby using the following configuration parameters:\n\n- `max_pool_size`: the maximum size of the connection pool. The default value is 50 connections.\n- `min_pool_size`: the threshold size of the connection pool. If the number of server connections is less than `min_pool_size`, then add more server connections to the pool. The default value is 0 connections.\n- `max_client_connections`: the maximum number of connections allowed for your instance. The default value is 5,000 connections.\n- `client_connection_idle_timeout`: the time that a client-connection remains idle before it times out. This value can range from 0 to 2,147,483 seconds, and the default value is 0 seconds.\n- `server_connection_idle_timeout`: the time that a server connection remains idle before it times out. This value can range from 0 to 2,147,483 seconds, and the default value is 600 seconds.\n- `query_wait_timeout`: the time that a query waits until it times out. This value can range from 0 to 2,147,483 seconds, and the default value is 120 seconds.\n- `max_prepared_statements`: the maximum number of protocol-level named prepared statements commands supported in transaction pooling mode. The default value is 0 statements.\n- `ignore_startup_parameters`: the parameters you want ignored, that aren't tracked in Managed Connection Pooling's startup packets by default.\n- `server_lifetime`: the maximum time a server connection is unused before Managed Connection Pooling closes it. The default value is 3600 seconds.\n\nLimitations\n-----------\n\nConsider the following limitations when using Managed Connection Pooling with\nyour Cloud SQL Enterprise Plus edition instances:\n\n- Enabling Managed Connection Pooling on an existing instance results in a database restart.\n- When you use the Cloud SQL API to enable, disable, or configure Managed Connection Pooling, the `instance.update` API can't contain any other instance configuration updates.\n- Managed Connection Pooling can only be used with Cloud SQL Auth Proxy version 2.15.2 and later.\n- If you're using the Cloud SQL Go Language Connector, then we recommend a minimum Go version of `1.24`. If you use Go version 1.23 or earlier, then you might experience limitations on performance when using Managed Connection Pooling.\n- If you're using Managed Connection Pooling in `transaction` pooling mode, then\n the following SQL features aren't supported:\n\n - `SET/RESET`\n - `LISTEN`\n - `WITH HOLD CURSOR`\n - `PREPARE/DEALLOCATE`\n - `PRESERVE/DELETE ROW` temp tables\n - `LOAD`\n - Session-level advisory locks\n- If you're using the\n [asyncpg database interface library](https://magicstack.github.io/asyncpg/current/)\n for Managed Connection Pooling pooler on port 3307 and 6432, then you must update the\n `max_prepared_statements` to a value larger than 0 to enable support for\n prepared statements in Managed Connection Pooling pooler.\n\n- If you're using Cloud SQL for PostgreSQL version 17, then the\n `sslnegotiation=direct` option isn't supported.\n\n- Client IP tracking isn't supported with Managed Connection Pooling. If you enable\n *store client IP addresses* in [query insights](/sql/docs/postgres/using-query-insights),\n then client IP addresses are displayed as `local` instead of the IP address\n itself.\n\nWhat's next\n-----------\n\n- [Create an instance](/sql/docs/postgres/create-instance)\n- [Configure Managed Connection Pooling](/sql/docs/postgres/configure-mcp)"]]