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
Situation Awareness
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

pg_profile_pro

Updated on 2024-10-14 GMT+08:00

Scenarios

pg_profile_pro is an extension used to monitor the performance and status of RDS for PostgreSQL DB instances. It provides monitoring data reports for SQL statements, tables, indexes, functions, transactions, and vacuum operations to detect existing or potential performance problems of databases.

Based on the pg_stat_statements view of PostgreSQL, this extension creates historical statistics in your DB instance and generates statistics samples. Periodic statistics samples are used to generate monitoring reports, helping identify resource-consuming activities.

CAUTION:

This extension is not supported temporarily due to its defects. It will be open to you after the defects are rectified. We are sorry for any inconvenience caused.

Constraints

Only RDS for PostgreSQL 12 supports this extension.

Procedure

  1. Run the following command to connect to the postgres database as user root and obtain the sample list.

    # psql --host=<RDS_ADDRESS> --port=<DB_PORT>--dbname=postgres --username=root -c "select * from profile.show_samples();"

    Table 1 Parameter description

    Parameter

    Description

    RDS_ADDRESS

    Indicates the IP address of the RDS DB instance.

    DB_PORT

    Indicates the port of the RDS DB instance.

    Enter the password of user root when prompted.

    Password for user root:

    Information similar to the following is displayed:

     sample |      sample_time       | dbstats_reset | clustats_reset | archstats_reset
    --------+------------------------+---------------+----------------+-----------------
          1 | 2021-04-02 17:15:49+08 |               |                |
          2 | 2021-04-02 17:25:57+08 |               |                |
          3 | 2021-04-02 17:36:04+08 |               |                |
    (3 rows)

    Use the actual query result.

  2. Connect to the postgres database as user root and obtain the report using either of the following methods:

    Method 1: Obtain the report based on the sample ID.

    # psql --host=<RDS_ADDRESS> --port=<DB_PORT> --dbname=postgres --username=root -Aqtc "select profile.get_report(<sample_start_id>, <sample_end_id>)" -o <filename>.html
    Table 2 Parameter description

    Parameter

    Description

    RDS_ADDRESS

    Indicates the IP address of the RDS DB instance.

    DB_PORT

    Indicates the port of the RDS DB instance.

    sample_start_id

    Indicates the start sample ID contained in the report.

    sample_end_id

    Indicates the end sample ID contained in the report.

    filename

    Indicates the name of the file where the report content is to be saved. You can specify a relative path or an absolute path for the file.

    NOTE:

    The value of sample_start_id must be smaller than that of sample_end_id. Otherwise, the report cannot be generated.

    Method 2: Obtain the report by specifying a time period.

    # psql --host=<RDS_ADDRESS> --port=<DB_PORT> --dbname=postgres --username=root -Aqtc "select profile.get_report(tstzrange('sample_start_time', 'sample_end_time'))" -o <filename>.html

    Table 3 Parameter description

    Parameter

    Description

    RDS_ADDRESS

    Indicates the IP address of the RDS DB instance.

    DB_PORT

    Indicates the port of the RDS DB instance.

    sample_start_time

    Indicates the sample start time contained in the report.

    sample_end_time

    Indicates the sample end time contained in the report.

    filename

    Indicates the name of the file where the report content is to be saved. You can specify a relative path or an absolute path for the file.

    NOTE:

    Retain the default values of the following parameters:

    • Sampling period (unit: minute): 10
    • Sample retention period (unit: day): 7
    • Number of displayed records: 20

Parameter Configuration

Table 4 Parameters affecting the sample report

Parameter

Default Value

Restart Required

Function

Remarks

pg_profile_pro.topn

20

No

Controls the number of objects (such as statements and relationships) to be reported in each sorting report.

This parameter affects the sample size. If you want to display more objects in the report, more objects need to be retained in the sample.

pg_profile_pro.max_sample_age

3

No

Indicates the sample retention period, in days. Samples whose retention period has exceeded the value of this parameter will be automatically deleted during the next sampling.

The minimum parameter granularity is day.

pg_profile_pro.track_sample_timings

off

No

Controls whether pg_profile_pro traces the detailed sampling time.

After this parameter is set to on, the time consumed by each sampling is recorded, which increases the space usage.

pg_profile_pro.period

3600

No

Indicates the sampling period, in seconds.

Controls the sampling period.

This parameter affects the sample size. The shorter the sampling period is, the more objects the report reserves due to more samples in unit time.

pg_profile_pro.enable

on

No

Controls whether the extension collects samples.

  • on: yes.
  • off: no.

If this parameter is set to off, the latest report cannot be generated, but the historical report can be viewed.

NOTE:

The default values in the table are for the latest RDS version and may vary in other versions.

Report Example

A report consists of title, contents, and tables.

  • Title

    The title contains start and end sample IDs, pg_profile_pro kernel version, server name, and report interval.

    Figure 1 Report title
  • Contents

    Each layer of contents is linked to a table. You can get an overview of all tables from the contents or click the links to view each table.

    The following figure shows a contents example.

  • Tables

    The tables display the database performance from different dimensions and focuses.

    • Each table is followed by suggestions on the focuses.
    • In each table, you can move the mouse pointer to a column title to view the comments (both in Chinese and English).

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