All Products
Search
Document Center

Hologres:Manage connections

Last Updated:Aug 12, 2026

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

Connections to a Hologres instance pass through an access layer and then an execution layer. Each layer enforces its own connection limit.

hologres-connection-arch-en

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_connections quota. Whether such requests use FixedFE instead depends on the client and the instance version. show max_connections returns 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_connections quota, 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 of max_connections and are governed by max_wal_senders.

Note

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 in pg_stat_activity. Query the dedicated hg_fixed_fe_stat_activity view 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 by max_wal_senders and defaults to 600.

  • Walsender connections are independent of max_connections. Neither consumes the other.

Note

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

client_max

8,000 (Hologres V4.0.15 and later, virtual warehouse instances)

Per Gateway node

The Gateway Connection Usage metric in the console

FE

max_connections

Depends on the instance type

Per FE node

show max_connections;

FE (instance level)

None

FE node count multiplied by max_connections

Per instance

select instance_max_connections();

FixedFE

Fixed value

6,400

Per FE node

Count rows in the hg_fixed_fe_stat_activity view

Walsender

max_wal_senders

600

Per FE node

None

Note

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

too many client tcp connections (global client_max)

Gateway, 8,000 per node

Look for connection leaks on the client. Add Gateway nodes if necessary.

sorry, too many clients already connection limit exceeded for superusers

FE max_connections

Terminate idle connections. For more information, see Terminate connections. Alternatively, scale up the instance or add FE nodes.

remaining connection slots are reserved for non-replication superuser connections

FE quota for regular users, with Superuser connections already reserved

Log on with the Superuser O&M account and terminate connections.

too many fixed frontend 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.

number of requested standby connections exceeds max_wal_senders

Walsender max_wal_senders

Check the number of binary log consumption jobs and whether stale connections remain after a failover.

terminating connection due to idle state timeout

Not a limit issue. The connection was reclaimed after an idle timeout.

Reconnect, or increase idle_session_timeout. For more information, see Auto-terminate idle connections.

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:

  • Realtime Compute for Apache Flink: {client_version}_ververica-connector-hologres.

  • Open-source Flink: {client_version}_hologres-connector-flink.

  • DataWorks Data Integration for batch synchronization (read from Hologres): datax_{jobId}.

  • DataWorks Data Integration for batch synchronization (write to Hologres): {client_version}_datax_{jobId}.

  • DataWorks Data Integration for real-time synchronization: {client_version}_streamx_{jobId}.

  • HoloWeb: holoweb.

  • Accessing Hologres using an external table in MaxCompute: MaxCompute.

  • A process started by a Holo Client to read the Hologres binlog: holo_client_replication. Query content is not displayed for this type of task.

  • For other applications, specify the application_name in the connection string.

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.

  • This field is null if no transaction is active.

  • If the current query is the first transaction in this process, this value is the same as query_start.

query_start

Start time of the currently active query. If the connection state is not active, this is the start time of the previous query.

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:

  • LWLock: The backend is waiting for a lightweight lock.

  • Lock: The backend is waiting for a heavyweight lock. The wait_event field identifies the type of lock being awaited.

  • BufferPin: The server process is waiting to access a data buffer while no other process is examining that buffer.

  • Activity: The server process is idle. This is used for system processes that are waiting for activity in their main processing loop.

  • Extension: The server process is waiting for activity within an extension module.

  • Client: The server process is waiting for a query from a client application and expects something to happen that is not related to its internal processing.

  • IPC: The server process is waiting for an activity from another process on the server.

  • Timeout: The server process is waiting for a timeout to occur.

  • IO: The server process is waiting for an I/O operation to complete.

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:

  • active: The connection is executing a query.

  • idle: The connection is waiting for a new client command.

  • idle in transaction: The connection is in a transaction but is not currently executing a query.

  • idle in transaction (Aborted): The connection is in a failed transaction and is not currently executing a query.

  • \N (Empty): Indicates a non-user process, typically a system background maintenance process that can be ignored.

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 active; otherwise shows the last executed query.

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 client backend type represents application connections, and the walsender type represents replication connections used for binary log consumption.

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.

  1. Log on to the HoloWeb console. Connect to HoloWeb and run SQL queries.

  2. In the top navigation bar, click Diagnostics and Optimization.

  3. In the left-side navigation pane, click Connections.

  4. On the Connections page, configure the parameters to view connections and related information for your instance.

    Note

    Only 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.

    Note

    If 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.

    Note

    Long 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.

  1. 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;
  2. 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-path function.

    • disabled: Indicates that track activities for 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.

  3. 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_connections command.

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.

Note

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 superusers error occurs.

  • The FATAL: remaining connection slots are reserved for non-replication superuser connections error is reported.

  • The FATAL: too many fixed frontend connections error is reported, which means the FixedFE layer hit its limit.

  • The too many client tcp connections error 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_.

    Account overview.

    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 283813xxxx to 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_timeout is 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_senders quota instead.

  • Monitor connection usage layer by layer

    • Access layer (Gateway): watch the Gateway Connection Usage metric in the console.

    • FE layer: query hologres.hg_connections for the water level of each FE node, then use pg_stat_activity to inspect individual connections.

    • FixedFE layer: count Fixed Plan connections in the hg_fixed_fe_stat_activity view.

    • Walsender: filter pg_stat_activity on backend_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.