Help Center > > Developer Guide> WDR Performance Analysis> Performance View Snapshot> Creating Snapshots

Creating Snapshots

Updated at: Nov 08, 2021 GMT+08:00

Snapshots can be created automatically or manually.

  • Automatic snapshot creation: The CCN periodically creates snapshots based on the interval specified by the GUC parameter wdr_snapshot_interval. If enable_wdr_snapshot is set to on, snapshots are created 30 seconds after the CCN instance is started, and then snapshots are created at an interval specified by wdr_snapshot_interval.
  • To manually create snapshots, execute the create_wdr_snapshot() function on the CN to apply for snapshots from the backend, as shown below.
select create_wdr_snapshot();
           create_wdr_snapshot            
------------------------------------------
 WDR snapshot request has been submitted.
(1 row)

Note that the output "WDR snapshot request has been submitted." in the preceding example indicates that the backend receives the snapshot creation request but does not indicate that snapshots are successfully created. If snapshots are being created in the backend when the request is received, the request will be ignored.

You can query the dbms_om.snapshot table to check whether the snapshots are successfully created. As shown below, before the create_wdr_snapshot function is executed, the snapshot data recorded in the dbms_om.snapshot table is as follows. The latest snapshot was created at 20:05:11.679013+08 on February 27, 2021.

select * from dbms_om.snapshot order by snapshot_id desc limit 5;
 snapshot_id |           start_ts            |            end_ts             
-------------+-------------------------------+-------------------------------
        3108 | 2021-02-27 20:05:11.679013+08 | 2021-02-27 20:05:43.860967+08
        3107 | 2021-02-27 20:01:53.087539+08 | 2021-02-27 20:02:16.353914+08
        3106 | 2021-02-27 19:55:11.099209+08 | 2021-02-27 19:55:44.028819+08
        3105 | 2021-02-27 19:45:10.191902+08 | 2021-02-27 19:45:44.610889+08
        3104 | 2021-02-27 19:35:10.204193+08 | 2021-02-27 19:35:44.73681+08
(5 rows)

Assume that the create_wdr_snapshot function was executed at 20:12:15.320135+08 on February 27, 2021. The query result of the dbms_om.snapshot table is as follows. The latest snapshot started at 2021-02-27 20:12:20.009353+08 and ended at 20:12:50.67686+08 on February 27, 2021, with the ID of 3109.

select * from dbms_om.snapshot order by snapshot_id desc limit 5;
 snapshot_id |           start_ts            |            end_ts             
-------------+-------------------------------+-------------------------------
        3109 | 2021-02-27 20:12:20.009353+08 | 2021-02-27 20:12:50.67686+08
        3108 | 2021-02-27 20:05:11.679013+08 | 2021-02-27 20:05:43.860967+08
        3107 | 2021-02-27 20:01:53.087539+08 | 2021-02-27 20:02:16.353914+08
        3106 | 2021-02-27 19:55:11.099209+08 | 2021-02-27 19:55:44.028819+08
        3105 | 2021-02-27 19:45:10.191902+08 | 2021-02-27 19:45:44.610889+08
(5 rows)

Each snapshot is uniquely identified by snapshot_id (bigint type), and the snapshot ID of different snapshots varies.

If the snapshot fails to be created, the message "WDR snapshot failed" is displayed in the pg_log file of the node, and the query result of the dbms_om.snapshot table shows that no new entry is generated. After a snapshot fails to be created, the snapshot thread attempts to create the snapshot again at an interval of one minute. If the snapshot still fails to be created after three retries, the system does not try again until the next snapshot expires or a snapshot creation request is received.

The snapshot data created for each performance view is stored in the dbms_om.snap_ table supplemented with the same name as the performance view. For details, see System Catalogs for Performance View Snapshot.

  • Snapshots are automatically and periodically created only for CCN nodes in cluster mode.
  • The snapshot ID is obtained by querying the dbms_om.snap_seq sequence. Do not query, modify, or delete the sequence externally. Otherwise, the snapshot function will be abnormal.
  • Before a snapshot is created, the backend checks the current cluster status. If the cluster is in the upgrade, scale-out, or scale-in state, the snapshot will be created after related operations are complete.

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