数据仓库服务 GAUSSDB(DWS)-其它函数:pg_stat_get_sql_count()

时间:2024-12-24 10:32:36

pg_stat_get_sql_count()

描述:提供当前节点中所有用户执行的SELECT/UPDATE/INSERT/DELETE/MERGE INTO语句的计数和响应时间的统计结果以及DDL、DML、DCL语句的计数结果。

返回值类型:record

示例:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
SELECT * FROM pg_stat_get_sql_count();
 node_name |       user_name        | select_count | update_count | insert_count | delete_count | mergeinto_count | ddl_count | dml_count | dcl_count | total_select_elapse | avg_select_elapse | max_select_el
apse | min_select_elapse | total_update_elapse | avg_update_elapse | max_update_elapse | min_update_elapse | total_insert_elapse | avg_insert_elapse | max_insert_elapse | min_insert_elapse | total_delete_ela
pse | avg_delete_elapse | max_delete_elapse | min_delete_elapse
-----------+------------------------+--------------+--------------+--------------+--------------+-----------------+-----------+-----------+-----------+---------------------+-------------------+--------------
-----+-------------------+---------------------+-------------------+-------------------+-------------------+---------------------+-------------------+-------------------+-------------------+-----------------
----+-------------------+-------------------+-------------------
 cn_5003   | gs_role_read_all_stats |            0 |            0 |            0 |            0 |               0 |         0 |         0 |         0 |                   0 |                 0 |
   0 |                 0 |                   0 |                 0 |                 0 |                 0 |                   0 |                 0 |                 0 |                 0 |
  0 |                 0 |                 0 |                 0
 cn_5003   | gs_role_signal_backend |            0 |            0 |            0 |            0 |               0 |         0 |         0 |         0 |                   0 |                 0 |
   0 |                 0 |                   0 |                 0 |                 0 |                 0 |                   0 |                 0 |                 0 |                 0 |
  0 |                 0 |                 0 |                 0
 cn_5003   | gs_role_analyze_any    |            0 |            0 |            0 |            0 |               0 |         0 |         0 |         0 |                   0 |                 0 |
   0 |                 0 |                   0 |                 0 |                 0 |                 0 |                   0 |                 0 |                 0 |                 0 |
  0 |                 0 |                 0 |                 0
 cn_5003   | gs_role_vacuum_any     |            0 |            0 |            0 |            0 |               0 |         0 |         0 |         0 |                   0 |                 0 |
   0 |                 0 |                   0 |                 0 |                 0 |                 0 |                   0 |                 0 |                 0 |                 0 |
  0 |                 0 |                 0 |                 0
 cn_5003   | dbadmin                |          641 |            0 |            3 |            0 |               0 |        18 |       651 |         5 |            19236129 |             30009 |           814
0206 |               357 |                   0 |                 0 |                 0 |                 0 |               70595 |             23531 |             62102 |              2750 |
  0 |                 0 |                 0 |                 0
 cn_5003   | Ruby                   |      2078187 |         3263 |        22841 |            0 |               0 |     10436 |   2242517 |     16979 |          3753441293 |              1806 |            52
6891 |               191 |            67483165 |             20681 |             38076 |             15444 |           291598980 |             12766 |             35376 |              3791 |
  0 |                 0 |                 0 |                 0
 cn_5003   | joe                    |            0 |            0 |            0 |            0 |               0 |         0 |         0 |         0 |                   0 |                 0 |
   0 |                 0 |                   0 |                 0 |                 0 |                 0 |                   0 |                 0 |                 0 |                 0 |
  0 |                 0 |                 0 |                 0
 cn_5003   | sea                    |          192 |            0 |            5 |            3 |               0 |         3 |       205 |         0 |             2561878 |             13343 |            68
1866 |               388 |                   0 |                 0 |                 0 |                 0 |               11349 |              2269 |              3241 |              1521 |               19
255 |              6418 |             10656 |              2798
 cn_5003   | jj                     |            0 |            0 |            0 |            0 |               0 |         0 |         0 |         0 |                   0 |                 0 |
   0 |                 0 |                   0 |                 0 |                 0 |                 0 |                   0 |                 0 |                 0 |                 0 |
  0 |                 0 |                 0 |                 0
 cn_5003   | u1                     |            2 |            0 |            2 |            0 |               0 |         1 |         4 |         0 |                3712 |              1856 |
2407 |              1305 |                   0 |                 0 |                 0 |                 0 |                5366 |              2683 |              3359 |              2007 |
  0 |                 0 |                 0 |                 0
(10 rows)
support.huaweicloud.com/sqlreference-dws/dws_06_0062.html