Understand the connection architecture of a Hologres instance, and diagnose and manage its connections.
Connection and query management
Hologres is PostgreSQL-compatible. Query the pg_stat_activity view to inspect connections and diagnose running queries. Key operations:
-
Connection architecture: how a client connection travels from the access layer (Gateway) to the execution layer (FE, FixedFE, and Walsender), and why each layer has its own connection limit.
-
Connection limits by layer: the connection limit of each layer and the error each one returns when the limit is reached.
-
Error message reference: identify which layer hit its limit from the error message, and what to do about it.
-
Query the default maximum number of connections: Each instance specification has a default connection limit. Run a command to query yours.
-
Manage connections in HoloWeb: View, manage, and terminate active connections in the HoloWeb console.
-
Query connections with SQL: Query connection counts, check states, and terminate idle connections.
-
Query FixedFE connections: FixedFE connections do not appear in pg_stat_activity. Query the dedicated view instead.
-
Terminate connections: Use SQL functions to release resources held by specific connections.
-
Reserved connections for Superusers: Use reserved connections for management when the connection limit is reached.
-
Limit connections for a single user: Set a per-user connection limit to prevent resource overuse.
-
Auto-terminate idle connections: Automatically close connections idle beyond a specified duration.
-
Best practices for using connections: Best practices for Hologres connection management.
Connection architecture
Connections to a Hologres instance pass through an access layer and then an execution layer. Each layer enforces its own connection limit.
The components are as follows:
-
Gateway: the single access layer of the instance. Every client connection lands on a Gateway node first. The Gateway authenticates the connection, checks it against the IP whitelist, and routes it to an FE or FixedFE node based on the connection attributes. An instance has at least two Gateway nodes for high availability. On virtual warehouse instances, the Gateway also routes connections to the FE of the target virtual warehouse.
-
FE (Frontend): the PostgreSQL-compatible frontend node that serves standard SQL connections, such as DDL statements, queries, and writes. Fixed Plan point queries and point writes can also run over FE connections, in which case they consume the FE
max_connectionsquota. Whether such requests use FixedFE instead depends on the client and the instance version.show max_connectionsreturns the limit of a single FE node. -
FixedFE (Fixed Frontend): a high-throughput connection service that runs alongside each FE node and is optimized primarily for Fixed Plan point queries and point writes, such as holo-client and the real-time ingestion paths of Flink and DataWorks. Starting from Hologres V2.1, binary log consumption also uses lightweight FixedFE connections by default. FixedFE connections are lightweight, do not count against the FE
max_connectionsquota, and have a separate limit that is much higher than the FE limit. -
Walsender: the process inside FE that serves logical replication connections (
replication=database). Because binary log consumption and real-time writes use lightweight FixedFE connections by default starting from Hologres V2.1, Walsender now mainly serves clients that still use the traditional replication protocol. Walsender connections are independent ofmax_connectionsand are governed bymax_wal_senders.
Different connection types consume quota from different layers. For example, when Fixed Plan writes exhaust the FixedFE quota, regular SQL connections are unaffected. Conversely, when regular connections fill up max_connections, the Fixed Plan path still works. When you troubleshoot a connection limit issue, first determine which layer hit its limit based on the error message. For more information, see Error message reference.
Connection limits by layer
Gateway connection limit
-
Starting from Hologres V4.0.15, a single Gateway node on a virtual warehouse instance accepts at most 8,000 connections. The limit was previously unbounded, and was introduced to keep very high connection rates from destabilizing the instance. For more information, see V4.0 (September 2025).
-
The Gateway limit for the whole instance is the number of Gateway nodes multiplied by 8,000. An instance has at least two Gateway nodes, and you can change the count in the console.
-
Use the Gateway Connection Usage metric in the console to watch peak pressure on the access layer.
When the limit is reached, the following error is returned:
too many client tcp connections (global client_max)
FE connection limit (max_connections)
The number of regular SQL connections that a single FE node accepts is set by max_connections. The default value depends on the instance type. Query it as follows:
-- Maximum connections of a single FE node.
show max_connections;
-- Maximum connections of the whole instance (FE node count multiplied by max_connections). Supported in Hologres V1.3.23 and later.
select instance_max_connections();
Hologres reserves a number of connections for Superusers (superuser_reserved_connections) so that you can still log on and perform administrative work, such as terminating idle connections, after the limit is reached. Regular users can therefore use max_connections minus the reserved connections.
When the limit is reached, one of the following errors is returned:
FATAL: sorry, too many clients already connection limit exceeded for superusers
FATAL: remaining connection slots are reserved for non-replication superuser connections
FixedFE connection limit
-
The FixedFE service on each FE node has its own limit of 6,400 connections per node.
-
The FixedFE limit for the whole instance is the number of FE nodes multiplied by 6,400.
-
FixedFE connections do not count against
max_connections, and they do not appear inpg_stat_activity. Query the dedicatedhg_fixed_fe_stat_activityview instead. For more information, see Query FixedFE connections. -
Typical FixedFE connections include Fixed Plan writes and point queries from holo-client, the Flink connector, and DataWorks Data Integration, as well as binary log consumption connections, which use lightweight connections by default starting from Hologres V2.1.
-
FixedFE connections are read-only for diagnostics: you cannot terminate them with SQL. If the FixedFE limit is reached, check the connection pool configuration on the client side or restart the affected job.
When the limit is reached, the following error is returned:
FATAL: too many fixed frontend connections
Walsender connection limit (max_wal_senders)
-
Logical replication connections (
replication=database) are served by Walsender processes on FE. The limit per FE node is set bymax_wal_sendersand defaults to 600. -
Walsender connections are independent of
max_connections. Neither consumes the other.
Starting from Hologres V2.1, real-time writes such as those from the Flink connector, and binary log consumption, use lightweight FixedFE connections by default and no longer go through Walsender. For dimension tables and result tables, the Flink connector selects the lightweight connection mode (connection.fixed.enabled) automatically on Hologres versions later than V3.0.28. For more information, see Parameter configuration (VVR 11+). As a result, the Walsender limit now affects only the few workloads that still use the traditional replication protocol. For more information about how binary logs are consumed, see Consume Binlog via JDBC.
When the limit is reached, the following error is returned:
FATAL: number of requested standby connections exceeds max_wal_senders (currently 600)
Limit summary
|
Layer |
Parameter |
Default or fixed value |
Scope |
How to check |
|
Gateway |
|
8,000 (Hologres V4.0.15 and later, virtual warehouse instances) |
Per Gateway node |
The Gateway Connection Usage metric in the console |
|
FE |
|
Depends on the instance type |
Per FE node |
|
|
FE (instance level) |
None |
FE node count multiplied by |
Per instance |
|
|
FixedFE |
Fixed value |
6,400 |
Per FE node |
Count rows in the |
|
Walsender |
|
600 |
Per FE node |
None |
You can view connection usage for all of these layers in the Monitoring>Traffic and Connections group of the instance in the Hologres console.
Error message reference
|
Error message |
Layer that hit its limit |
What to do |
|
|
Gateway, 8,000 per node |
Look for connection leaks on the client. Add Gateway nodes if necessary. |
|
|
FE |
Terminate idle connections. For more information, see Terminate connections. Alternatively, scale up the instance or add FE nodes. |
|
|
FE quota for regular users, with Superuser connections already reserved |
Log on with the Superuser O&M account and terminate connections. |
|
|
FixedFE, 6,400 per node |
Check whether the connection pool of a Fixed Plan client such as holo-client or the Flink connector is oversized or leaking. |
|
|
Walsender |
Check the number of binary log consumption jobs and whether stale connections remain after a failover. |
|
|
Not a limit issue. The connection was reclaimed after an idle timeout. |
Reconnect, or increase |
Query the pg_stat_activity view
The pg_stat_activity view provides runtime information about instance connections and queries. Run the following command to query it.
select * from pg_stat_activity ;
The following table describes the pg_stat_activity fields.
|
Field |
Description |
|
datid |
The object ID (OID) of the database that the backend is connected to. |
|
datname |
The name of the database that the backend is connected to. |
|
pid |
The process ID (PID) of the Hologres backend. |
|
usesysid |
The OID of the user logged in to the Hologres backend. |
|
usename |
The username for the current connection. |
|
application_name |
The type of client application. Common application types include:
|
|
client_addr |
The IP address of the client. This may be a resolved address, not the original source IP. |
|
client_hostname |
The hostname of the client. |
|
client_port |
The port of the client. |
|
backend_start |
Time the backend process started. |
|
xact_start |
Start time of the process's current transaction.
|
|
query_start |
Start time of the currently active query. If the connection state is not |
|
state_change |
Time the connection's state was last changed. |
|
wait_event_type |
The type of event for which the backend is waiting, or NULL if none. Possible values include:
|
|
wait_event |
The name of the wait event if the backend is currently waiting, otherwise NULL. |
|
state |
The current state of the connection. Common states include:
|
|
backend_xid |
The top-level transaction identifier of the Hologres backend. |
|
backend_xmin |
The current backend's xmin horizon. |
|
query |
The most recent query on the backend. Shows the running query if state is |
|
backend_type |
The backend type. Possible values: autovacuum launcher, autovacuum worker, logical replication launcher, logical replication worker, parallel worker, background writer, client backend, checkpointer, startup, walreceiver, walsender, walwriter, and backend execution components such as PQE. Note
The |
Usage notes
Only Superusers can view all connections. Standard users see only their own.
Default maximum connections
The default connection limit varies by instance specification. Run the following commands to query it. Each command returns the per-FE-node limit. Multiply by the number of FE nodes to get the total instance limit. FE node counts are listed in Instance management.
-
Query the maximum connections for the entire instance (Hologres V1.3.23 and later).
select instance_max_connections(); -
Query the maximum connections for a single FE node. Multiply by the number of FE nodes to get the total instance limit.
show max_connections;
Manage connections in HoloWeb
View and manage active connections in the HoloWeb console.
-
Log on to the HoloWeb console. Connect to HoloWeb and run SQL queries.
-
In the top navigation bar, click Diagnostics and Optimization.
-
In the left-side navigation pane, click Connections.
-
On the Connections page, configure the parameters to view connections and related information for your instance.
NoteOnly Superusers can view all connections. Standard users see only their own.
The following table describes the parameters.
Parameter
Description
Instance name
The Hologres instance name.
Database
The Hologres database. Leave blank to display connections to all databases.
Database
The name of the connected database.
NoteIf the database name is Postgres, it indicates a backend maintenance connection, which can be ignored.
User Name
The user account for the connection.
Client Address
This may be a routed outbound IP address, not the original source IP.
Application Name
The name of the application that created the connection.
State
The state of the connection. Common states include:
-
active: The connection is active.
-
idle: The connection is idle.
-
idle in transaction: The connection is idle within a long-running transaction.
-
idle in transaction (Aborted): The connection is idle within a failed transaction.
Query Start
The start time of the query.
Query
The executed query.
NoteLong queries might be truncated.
PID
The process ID (PID) of the query.
Operation
-
Kill: Terminate unexpected connections individually or in batches.
-
Details: Click to view detailed information about the connection.
-
Query connections with SQL
Use the following SQL statements to query connection information.
-
Query the number of connections to the current database.
Run the following commands to view the connection count for the current database. Field descriptions are in Query the pg_stat_activity view.
-
For Hologres V1.1 and later:
SELECT datname::TEXT ,COUNT(1) AS COUNT FROM pg_stat_activity WHERE backend_type = 'client backend' AND application_name != 'hologres' GROUP BY datname::TEXT; -
For Hologres V0.10 and earlier:
SELECT datname ,COUNT(1) AS COUNT FROM pg_stat_activity WHERE backend_type = 'client backend' AND application_name != 'hologres' GROUP BY datname;
-
-
View the state of each connection.
Use HoloWeb in the Hologres console to view connection status, or run the following statement to query all JDBC or PSQL connection states.
select * from pg_stat_activity where backend_type = 'client backend' and state = '<statename>';Replace
<statename>with one of the following states:-
idle: The process is waiting for new client commands.
-
active: An active connection, where the process is executing a query. -
idle in transaction: The process is in a transaction but is not currently executing a query. -
idle in transaction (aborted): The process is in a failed transaction, and the process is not currently executing a query. -
fastpath function call: Indicates that a process is executing a
fast-pathfunction. -
disabled: Indicates that
track activitiesfor the process is disabled.
For example, query idle connections:
select * from pg_stat_activity where backend_type = 'client backend' and state = 'idle';Hologres components such as HoloWeb use JDBC and consume connections. If the count consistently approaches
max_connections, check your application for connection leaks and configure an appropriate connection pool. Release connections. -
-
View the number of connections on each access node
Query the connection count on each FE node (Hologres V1.3.23 and later). FE nodes without active connections are omitted from results.
select * from hologres.hg_connections;The following table describes the fields in the query result.
-
fe_id: The ID of the FE node. -
used_connections: The number of connections currently in use on the FE node. -
max_connections: The maximum number of connections for an FE node, which is the same as the return value of the
show max_connectionscommand.
-
Query FixedFE connections
FixedFE connections, which serve Fixed Plan writes and point queries, do not appear in pg_stat_activity. Query the dedicated hg_fixed_fe_stat_activity view instead.
-- List all FixedFE connections on the current FE node.
select * from hg_fixed_fe_stat_activity;
-- Count FixedFE connections to compare against the limit of 6,400.
select count(*) from hg_fixed_fe_stat_activity;
-- Group FixedFE connections by database, user, and application.
SELECT datname
,usename
,application_name
,COUNT(1)
FROM hg_fixed_fe_stat_activity
GROUP BY datname
,usename
,application_name;
Key fields include datname, conn_id (the FixedFE connection ID), usename, application_name, client_addr, client_port, backend_start, state, query_start, and query. The backend_type field is always fixed frontend connection.
Only Superusers can see all FixedFE connections. Regular users see only their own. FixedFE connections are read-only for diagnostics and cannot be terminated with functions such as pg_terminate_backend. To release a FixedFE connection, close it on the client side or restart the job that owns it, such as a Flink deployment.
Terminate connections
The following symptoms indicate the connection limit has been reached:
-
The connection count reaches or exceeds
max_connections, as shown on the Monitoring and Alarms page in the Hologres console. -
The
FATAL: sorry, too many clients already connection limit exceeded for superuserserror occurs. -
The
FATAL: remaining connection slots are reserved for non-replication superuser connectionserror is reported. -
The
FATAL: too many fixed frontend connectionserror is reported, which means the FixedFE layer hit its limit. -
The
too many client tcp connectionserror is reported, which means the Gateway layer hit its limit.
First identify which layer hit its limit. For more information, see Error message reference. If the FE layer is full, connect with a Superuser account, which uses the reserved connections, and run the following statement to check for idle connections.
select * from pg_stat_activity where backend_type = 'client backend' and state = 'idle';
If results show excessive idle processes, use the pid from the results to release connections with the following statements. Field descriptions are in Query the pg_stat_activity view.
select pg_cancel_backend(<pid>); -- Cancels the query on the connection.
select pg_terminate_backend(<pid>); -- Terminates the corresponding backend connection process.
-- Terminate backend IDLE connection processes in a batch to release connections.
SELECT pg_terminate_backend(pid)
,query
,datname
,usename
,application_name
,client_addr
,client_port
,backend_start
,state
FROM pg_stat_activity
WHERE length(query) > 0
AND pid != pg_backend_pid()
AND backend_type = 'client backend'
AND state = 'idle'
AND application_name != 'hologres'
AND query not like '%pg_cancel_backend%';
Reserved connections for Superusers
Hologres reserves connections for Superusers; the count varies by instance specification (Instance management). These connections enable management tasks such as terminating idle connections when the limit is reached. Standard users can use max_connections minus the reserved count. Do not use Superuser accounts for regular operations — this can exhaust all connections and block administrative access.
User connection limits
Set a user connection limit
Set a per-user connection limit to prevent excessive resource consumption.
Run the following statement to limit connections for a user on a single access node. For multi-node instances, the total limit is (connections per node) * (number of nodes).
-
Syntax
ALTER ROLE "Alibaba Cloud account ID" CONNECTION LIMIT <number>; -
Parameters
Parameter
Description
Alibaba Cloud account ID
The ID of the account to limit. For a RAM user, prefix the account UID with
p4_.number
The connection limit.
The value must be in the range of [-1, N]. A value of -1 removes the user's connection limit.
-
Example
This example limits RAM user
283813xxxxto one connection per node.ALTER ROLE "p4_283813xxxx" CONNECTION LIMIT 1;
View user connection limits
Run the following statement to view per-node connection limits for instance users.
SELECT rolname, rolconnlimit
FROM pg_roles
WHERE rolconnlimit <> -1;
Sample query result:
rolname | rolconnlimit
---------------+--------------
p4_283813xxxx | 1
(1 row)
Auto-terminate idle connections
If instance connections consistently approach the limit, your application may have connection leaks. Enable automatic idle connection termination to release resources. Connections idle beyond the specified duration are automatically disconnected.
-
Limitations
Supported in Hologres V0.10.25 and later. For earlier versions, see Common errors that occur during an upgrade or join the Hologres DingTalk group to request an upgrade. How do I get more online support?
-
Syntax
-
Session level
-- Automatically disconnect a connection if it has been idle for 10 minutes (600,000 milliseconds). SET idle_session_timeout = 600000; -
Database level
-- Automatically disconnect connections to this database if they have been idle for 10 minutes (600,000 milliseconds). ALTER DATABASE <db_name> SET idle_session_timeout = 600000;Replace
<db_name>with the name of the database for which you want to enable automatic termination of idle connections.
-
Connection best practices
Follow these best practices for using Hologres connections.
-
Use the Superuser account wisely
-
Do not use Superuser accounts for application connections or regular operations. If connections exceed the limit, even Superusers may be unable to connect.
-
Create a dedicated Superuser account for emergencies such as connection limit exhaustion or hung queries.
-
-
Configure a proper connection pool
-
Hologres does not automatically terminate idle connections by default, unless
idle_session_timeoutis enabled. Use a connection pool to release idle connections promptly. -
Periodically clean up idle connections to free resources.
-
Size the connection pool of Fixed Plan clients such as holo-client and the Flink connector just as carefully. They consume the FixedFE quota of 6,400 per node, and a leak there breaks the Fixed Plan path.
-
After a binary log consumption job fails over, confirm that its old connections are released so that stale connections do not exhaust the FixedFE quota. Binary log consumption uses lightweight FixedFE connections by default starting from Hologres V2.1. If you still use the traditional Walsender replication protocol, watch the
max_wal_sendersquota instead.
-
-
Monitor connection usage layer by layer
-
Access layer (Gateway): watch the Gateway Connection Usage metric in the console.
-
FE layer: query
hologres.hg_connectionsfor the water level of each FE node, then usepg_stat_activityto inspect individual connections. -
FixedFE layer: count Fixed Plan connections in the
hg_fixed_fe_stat_activityview. -
Walsender: filter
pg_stat_activityonbackend_type = 'walsender'to see binary log consumption connections.
-
Common errors
-
An error message is returned during SQL execution:
terminating connection due to idle state timeout. -
Cause: The connection was automatically terminated because it exceeded the configured idle timeout.
-
Solution: Reconnect to the instance or increase the idle connection timeout. For information about how to modify the idle connection timeout, see Auto-terminate idle connections.
For more connection-related errors and how to handle them, see Error message reference.