Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Managing Database Connections

Updated on 2023-03-17 GMT+08:00

Scenario

By default, a database supports a certain number of connections. Administrators can manage database connections to learn about the connection performance of the current database or increase the connection limit so that more users or applications can connect to the database at the same time.

Maximum Number of Connections

The number of connections supported by a cluster depends on its node flavor.

Table 1 Number of supported connections

Parameter

Node Flavor

Number of CN Connections

Number of DN Connections

max_connections

vCPUs < 16

512

Number of CN connections x 2

vCPUs > 16 && <= 32

1024

Number of CN connections x 2

other

2048

Number of CN connections x 2

NOTE:

The policies of comm_max_stream, poolsize, and max_prepared_transactions are the same as those of max_connections.

Viewing the Maximum Number of Connections

  1. Use the SQL client tool to connect to the database in a cluster.
  2. Run the following command:

    1
    SHOW max_connections;
    

    Information similar to the following is displayed, showing that the maximum number of database connections is 200 by default.

    max_connections
    ----------------- 
    200
    (1 row)

Viewing the Number of Used Connections

  1. Use the SQL client tool to connect to the database in a cluster.
  2. View the number of connections in scenarios described in Table 2.

    Table 2 Viewing the number of connections

    Description

    Command

    View the maximum number of sessions connected to a specific user.

    Run the following command to view the maximum number of sessions connected to user dbadmin.

    1
    SELECT ROLNAME,ROLCONNLIMIT FROM PG_ROLES WHERE ROLNAME='dbadmin';
    

    Information similar to the following is displayed. -1 indicates that the number of sessions connected to user dbadmin is not limited.

     rolname  | rolconnlimit
    ----------+--------------
     dwsadmin |           -1
    (1 row)

    View the number of session connections that have been used by a user.

    Run the following command to view the number of session connections that have been used by dbadmin.

    1
    SELECT COUNT(*) FROM V$SESSION WHERE USERNAME='dbadmin';
    

    Information similar to the following is displayed. 1 indicates the number of session connections used by user dbadmin.

     count
    -------
         1
    (1 row)

    View the maximum number of sessions connected to a specific database.

    Run the following command to view the upper limit of connections used by gaussdb.

    1
    SELECT DATNAME,DATCONNLIMIT FROM PG_DATABASE WHERE DATNAME='gaussdb';
    

    Information similar to the following is displayed. -1 indicates that the number of sessions connected to database gaussdb is not limited.

     datname  | datconnlimit
    ----------+--------------
     gaussdb |           -1
    (1 row)

    View the number of session connections that have been used by a database.

    Run the following command to view the number of session connections that have been used by gaussdb.

    1
    SELECT COUNT(*) FROM PG_STAT_ACTIVITY WHERE DATNAME='gaussdb';
    

    Information similar to the following is displayed. 1 indicates the number of session connections used by database gaussdb.

     count 
    -------
         1
    (1 row)

    View the number of session connections that have been used by all users.

    Run the following command to view the number of session connections that have been used by all users:

    1
    SELECT COUNT(*) FROM V$SESSION;
    

    Information similar to the following is displayed.

     count
    -------
         10
    (1 row)

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback