数据仓库服务 GAUSSDB(DWS)-用户资源监控:操作步骤
操作步骤
- 查询所有用户的资源限额和资源实时使用情况。
1
SELECT * FROM PG_TOTAL_USER_RESOURCE_INFO;
得到的结果视图如下:
username | used_memory | total_memory | used_cpu | total_cpu | used_space | total_space | used_temp_space | total_temp_space | used_spill_space | total_spill_space | read_kbytes | write_kbytes | read_counts | write_counts | read_speed | write_speed | send_speed | recv_speed -----------------------+-------------+--------------+----------+-----------+------------+-------------+-----------------+------------------+------------------+-------------------+-------------+--------------+-------------+--------------+------------+-------------+------------+------------ perfadm | 0 | 0 | 0 | 0 | 0 | -1 | 0 | -1 | 0 | -1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 usern | 0 | 17250 | 0 | 48 | 0 | -1 | 0 | -1 | 0 | -1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 (2 rows)
其中,IO资源监控字段(read_kbytes、write_kbytes、read_counts、write_counts、read_speed和write_speed)需要在GUC参数enable_user_metric_persistent开启时才有监控数据。
所查各字段说明详见PG_TOTAL_USER_RESOURCE_INFO 。
- 查询具体某个用户的资源限额和资源实时使用情况。
1
SELECT * FROM GS_WLM_USER_RESOURCE_INFO('username');
查询结果如下:
userid | used_memory | total_memory | used_cpu | total_cpu | used_space | total_space | used_temp_space | total_temp_space | used_spill_space | total_spill_space | read_kbytes | write_kbytes | read_counts | write_counts | read_speed | write_speed | send_speed | recv_speed --------+-------------+--------------+----------+-----------+------------+-------------+-----------------+------------------+------------------+-------------------+-------------+--------------+-------------+--------------+------------+-------------+------------+------------ 16407 | 18 | 1655 | 6 | 19 | 13787176 | -1 | 0 | -1 | 0 | -1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 (1 row)
- 查询所有用户的资源限额和资源历史使用情况。
1
SELECT * FROM GS_WLM_USER_RESOURCE_HISTORY;
查询结果如下:
username | timestamp | used_memory | total_memory | used_cpu | total_cpu | used_space | total_space | used_temp_space | total_temp_space | used_spill_space | total_spill_space | read_kbytes | write_kbytes | read_counts | write_counts | read_speed | write_speed | send_speed | recv_speed -----------------------+-------------------------------+-------------+--------------+----------+-----------+------------+-------------+-----------------+------------------+------------------+-------------------+-------------+--------------+-------------+--------------+-------------+-------------+------------+------------ usern | 2020-01-08 22:56:06.456855+08 | 0 | 17250 | 0 | 48 | 0 | -1 | 0 | -1 | 88349078 | -1 | 45680 | 34 | 5710 | 8 | 320 | 0 | 0 | 0 userg | 2020-01-08 22:56:06.458659+08 | 0 | 15525 | 33.48 | 48 | 0 | -1 | 0 | -1 | 110169581 | -1 | 17648 | 23 | 2206 | 5 | 123 | 0 | 0 | 0 userg1 | 2020-01-08 22:56:06.460252+08 | 0 | 13972 | 33.48 | 48 | 0 | -1 | 0 | -1 | 136106277 | -1 | 17648 | 23 | 2206 | 5 | 123 | 0 | 0 | 0
对于系统表GS_WLM_USER_RESOURCE_HISTORY,仅当GUC参数enable_user_metric_persistent开启时,才会定期将视图PG_TOTAL_USER_RESOURCE_INFO中的数据保存到历史表中。
所查各字段说明详见GS_WLM_USER_RESOURCE_HISTORY。
- DWS资源管理_GaussDB(DWS)资源管理作用_DWS资源管控
- 数据仓库服务GaussDB(DWS)_SQL on Anywhere
- DWS安全_数据仓库服务安全_DWS数据安全管理_DWS安全保障_DWS安全策略
- 调用GaussDB(DWS) API接口_数据仓库服务调用API_如何调用API_在DWS中调用API
- DWS产品介绍_DWS产品优势_DWS功能_DWS使用场景_DWS是什么
- 数据库监控DMS_数据库智能运维_了解Auto Pilot_DMS_DWS节点监控
- GaussDB监控_GaussDB数据库监控_高斯数据库监控_华为云
- GAUSS(DWS)工具_gsql工具_DataStudio工具_DSC工具
- GaussDB数据库监控_什么是GaussDB_高斯数据库监控
- 什么是数据湖探索服务_数据湖探索DLI用途与特点