Help Center > > Developer Guide> WDR Performance Analysis> Workload Diagnosis Report> Creating a WDR

Creating a WDR

Updated at: Sep 17, 2021 GMT+08:00

Precautions

  • Only the system administrator can access a WDR.
  • You need to generate a WDR as required and delete unnecessary WDRs in a timely manner to avoid insufficient storage space.
  • WDRs can be opened using a web browser. The current version supports Internet Explorer 11.0 or later and Chrome (64-bit) 87.0 or later.

Procedure for Creating a WDR

Use the generate_wdr_report function to create a WDR.

  1. Before generating a report, you need to determine the start and end snapshot IDs. Query the dbms_om.snapshot table to obtain snapshot IDs corresponding to the two time points of the required period.

    For example, to view the performance status between 03:00:00 and 04:00:00 on February 21, 2021, run the following command:
    select * from dbms_om.snapshot where start_ts > '2021-02-21 03:00:00'::timestamptz and start_ts < '2021-02-21 04:00:00'::timestamptz order by snapshot_id;
     snapshot_id |           start_ts            |            end_ts             
    -------------+-------------------------------+-------------------------------
            2147 | 2021-02-21 03:02:40.000716+08 | 2021-02-21 03:03:17.840595+08
            2148 | 2021-02-21 03:12:39.873876+08 | 2021-02-21 03:13:15.963517+08
            2149 | 2021-02-21 03:22:39.875301+08 | 2021-02-21 03:23:16.659778+08
            2150 | 2021-02-21 03:32:40.857761+08 | 2021-02-21 03:33:18.477795+08
            2151 | 2021-02-21 03:42:41.454982+08 | 2021-02-21 03:43:17.977323+08
            2152 | 2021-02-21 03:52:41.794683+08 | 2021-02-21 03:53:18.676577+08
    (6 rows)

    According to the preceding query result, the start snapshot ID and end snapshot ID of the period are 2147 and 2152 respectively.

  2. Determine the type of the WDR to be generated. In the current version, three types of WDRs can be generated:

    • Summary: A WDR contains only brief analysis and calculation results.
    • Detail: A WDR contains only detailed indicator data.
    • All: A WDR contains content of both the summary and detail WDRs.

  3. Determine the scope of the WDR to be generated. The available scopes are as follows:

    • Cluster: A WDR provides performance data of the entire cluster.
    • Node: A WDR provides performance data of a specified node.

    The function scopes and principles of views are different. Therefore, the indicator types and meanings involved in the two scopes are different.

    For example, to generate a summary WDR for the cluster between 03:00:00 and 04:00:00 on February 21, 2021, run the following command:

    select generate_wdr_report(2147, 2152, 'summary', 'cluster', '');
                               generate_wdr_report                            
    --------------------------------------------------------------------------
     Report summary-cluster-2147-2152-20210301125740.html has been generated.
    (1 row)

    To generate a WDR for the cn_5001 node from 03:00:00 to 04:00:00 on February 21, 2021, run the following command:

    select generate_wdr_report(2147, 2152, 'all', 'node', 'cn_5001');
                             generate_wdr_report                          
    ----------------------------------------------------------------------
     Report all-cn_5001-2147-2152-20210301125906.html has been generated.
    (1 row)

  4. The WDR is created successfully, and the system displays the message "$WDR name has been generated."

WDR Name Format

By default, the WDR is stored in the pg_log directory of the current CN node. The WDR name consists of the fields listed below and connected by a hyphen (-):

Table 1 Composition of a WDR name

Field Name

Format

Description

Report type

%s

Summary, detail, or all, which is the same as the type of the generated WDR.

Scope

%s

For a cluster, the value is cluster. For a node, the value is the node name.

Start snapshot ID

%d

Snapshot ID 1.

ID of the snapshot to be stopped

%d

Snapshot ID 2.

Timestamp

%y%m%d%H%M%S

Time when a report is created.

For example, the all-cn_5001-2147-2152-20210301125906.html file generated in step 3 indicates the report type is all, the scope is cn_5001, the start and end snapshot IDs are 2147 and 2152 respectively, and the report is generated at 12:59:06 on March 1, 2021.

WDR Generation Condition

  • During WDR generation, the values of two snapshots need to be compared. Therefore, the data between the two snapshots must be continuous. If a statistics reset event occurs between two snapshots, the data cannot be used for analysis and calculation. You can query the dbms_om. SNAP_PGXC_NODE_STAT_RESET_TIME table to obtain the timestamp of the latest reset event before each snapshot.
  • If the reset time of the same node in the two snapshots used to generate a WDR is the same, no reset event occurs between the two snapshots, and a WDR can be generated. Otherwise, no WDR can be generated.

For details about statistics reset events, see the get_node_stat_reset_time() function and PGXC_NODE_STAT_RESET_TIME view in section "Functions and Operators > System Administration Functions > Other Functions" in .

For example, for snapshots 2147 and 2152 in the preceding example, the reset time of the dn_6001_6002 node is as follows:

select * from dbms_om.snap_pgxc_node_stat_reset_time where (snapshot_id=2147 or snapshot_id=2152) and snap_node_name='cn_5001';
 snapshot_id | snap_node_name |        snap_reset_time        
-------------+----------------+-------------------------------
        2152 | dn_6001_6002        | 2021-02-19 11:01:28.815382+08
        2147 | dn_6001_6002        | 2021-02-19 11:01:28.815382+08
(2 rows)

The reset time for the two snapshots is the same. Therefore, a WDR can be generated for the dn_6001_6002 node. If a WDR is generated for the DN node, the reset time of the node must be the same. If a WDR is generated for the cluster or the CN node, the reset timestamps of all corresponding nodes must be the same.

with s1 as (select * from dbms_om.snap_pgxc_node_stat_reset_time where snapshot_id=2147),
s2 as (select * from dbms_om.snap_pgxc_node_stat_reset_time where snapshot_id=2152)
select * from s1,s2 where s1.snap_node_name=s2.snap_node_name and s1.snap_reset_time <> s2.snap_reset_time;
 snapshot_id | snap_node_name | snap_reset_time | snapshot_id | snap_node_name | snap_reset_time 
-------------+----------------+-----------------+-------------+----------------+-----------------
(0 rows)

If the reset timestamps of some nodes are different, the WDR of the node or cluster cannot be generated. For example, the cn_5001 node was reset at 14:41:23 on March 1, 2021. As a result, the reset time of snapshot 3360 is different from that of snapshot 3366.

with s1 as (select * from dbms_om.snap_pgxc_node_stat_reset_time where snapshot_id=3360),
s2 as (select * from dbms_om.snap_pgxc_node_stat_reset_time where snapshot_id=3366)
select * from s1,s2 where s1.snap_node_name=s2.snap_node_name and s1.snap_reset_time <> s2.snap_reset_time;
 snapshot_id | snap_node_name |        snap_reset_time        | snapshot_id | snap_node_name |        snap_reset_time        
-------------+----------------+-------------------------------+-------------+----------------+-------------------------------
        3360 | cn_5001        | 2021-02-25 11:23:33.979406+08 |        3366 | cn_5001        | 2021-03-01 14:41:23.927363+08
(1 row)

If a WDR is generated for the CN node or cluster based on snapshot 3360 and snapshot 3366, the following error is reported:

select generate_wdr_report(3360, 3366, 'all', 'node', 'cn_5001');
ERROR:  [WDRReport] Instance reset time is different
CONTEXT:  referenced column: generate_wdr_report
select generate_wdr_report(3360, 3366, 'all', 'node', 'cn_5002');
ERROR:  [WDRReport] Instance reset time is different
CONTEXT:  referenced column: generate_wdr_report
select generate_wdr_report(3360, 3366, 'all', 'cluster', '');
ERROR:  [WDRReport] Instance reset time is different
CONTEXT:  referenced column: generate_wdr_report

However, a WDR can be properly generated for other DN nodes.

select generate_wdr_report(3360, 3366, 'all', 'node', 'dn_6001_6002');
                            generate_wdr_report                            
---------------------------------------------------------------------------
 Report all-dn_6001_6002-3360-3366-20210301145226.html has been generated.
(1 row)

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel