[gpadmin@bogon ~]$ psql -d tpch1s # 第2个psql客户端 tpch1s=# select pid,sess_id,query,rsgid,rsgname from pg_stat_activity; -- 迁移前状态 pid | sess_id | query | rsgid | rsgname ---------+---------+------------------------------------------------------------------------------+-------+------------- 2933567 | 6 | select +| 6438 | admin_group | | l_returnflag, +| | | | l_linestatus, +| | | | sum(l_quantity) as sum_qty, +| | | | sum(l_extendedprice) as sum_base_price, +| | …… -- 上述查询pid为2933567,资源组是admin_group(oid为6438)。 tpch1s=# SELECT gp_toolkit.pg_resgroup_move_query(2933567, 'default_group') FROM pg_stat_activity; -- 迁移到default_group资源组 -- 如果是master分支,迁移命令为: -- SELECT pg_resgroup_move_query(2933567, 'default_group') FROM pg_stat_activity; tpch1s=# select pid,sess_id,query,rsgid,rsgname from pg_stat_activity; -- 迁移后状态 pid | sess_id | query | rsgid | rsgname ---------+---------+------------------------------------------------------------------------------+-------+--------------- 2933567 | 6 | select +| 6437 | default_group | | l_returnflag, +| | | | l_linestatus, +| | | | sum(l_quantity) as sum_qty, +| | | | sum(l_extendedprice) as sum_base_price, +| | …… -- 可以看到,pid为2933567的查询以及迁移到default_group组(oid为6437)