In the multi-tenant management framework, you can query the real-time usage of all user resources (including the memory, number of CPU cores, storage space, temporary space, operator spilling space, and I/Os) in real time through the system views PG_TOTAL_USER_RESOURCE_INFO and PGXC_TOTAL_USER_RESOURCE_INFO and the function GS_WLM_USER_RESOURCE_INFO. You can also query the system catalog GS_WLM_USER_RESOURCE_HISTORY and system view PGXC_WLM_USER_RESOURCE_HISTORY for the historical usage of user resources.
1 | SELECT * FROM PG_TOTAL_USER_RESOURCE_INFO; |
The result view is as follows:
1 2 3 4 5 | 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) |
The I/O resource monitoring fields (read_kbytes, write_kbytes, read_counts, write_counts, read_speed, and write_speed) can be available only when the GUC parameter described in enable_user_metric_persistent is enabled.
For details about each column, see PG_TOTAL_USER_RESOURCE_INFO.
1 | SELECT * FROM GS_WLM_USER_RESOURCE_INFO('username'); |
The query result is as follows:
1 2 3 4 | 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; |
The query result is as follows:
1 2 3 4 5 | 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 |
For the system catalog in GS_WLM_USER_RESOURCE_HISTORY, data in the PG_TOTAL_USER_RESOURCE_INFO view is periodically saved to historical tables only when the GUC parameter enable_user_metric_persistent is enabled.
For details about each column, see GS_WLM_USER_RESOURCE_HISTORY.