数据仓库服务 GAUSSDB(DWS)-query_band负载识别:示例

时间:2024-12-09 15:13:09

示例

  1. 设置query_band“JobName=abc”关联资源池p1、队列内优先级Rush、次序为1。

    1
    2
    3
    4
    5
    SELECT * FROM gs_wlm_set_queryband_action('JobName=abc','respool=p1;priority=rush',1);
    gs_wlm_set_queryband_action
    -----------------------------
     t
    (1 row)
    

  2. 修改query_band“JobName=abc”的关联资源池为p2。

    1
    2
    3
    4
    5
    SELECT * FROM gs_wlm_set_queryband_action('JobName=abc','respool=p2');
    gs_wlm_set_queryband_action
    -----------------------------
     t
    (1 row)
    

  3. 修改query_band“JobName=abc”的队列内优先级为High。

    1
    2
    3
    4
    5
    SELECT * FROM gs_wlm_set_queryband_action('JobName=abc','priority=high');
    gs_wlm_set_queryband_action
    -----------------------------
     t
    (1 row)
    

  4. 修改query_band“JobName=abc”的次序为3。

    1
    2
    3
    4
    5
    SELECT * FROM gs_wlm_set_queryband_order('JobName=abc',3);
    gs_wlm_set_queryband_order
    -----------------------------
     t
    (1 row)
    

  5. 查询query_band关联的负载行为。

    1
    2
    3
    4
    5
    SELECT * FROM pg_queryband_action;
        qband     | respool_id | respool | priority | qborder
    --------------+------------+---------+----------+---------
     JobName=abc  |      17119 | p2      | high     |       1
    (1 row)
    

  6. 设置query_band“AppName=test”队列内优先级Low,使用用户关联资源池,同时使用默认次序。

    1
    2
    3
    4
    5
    SELECT * FROM gs_wlm_set_queryband_action('AppName=test','priority=low');
    gs_wlm_set_queryband_action
    -----------------------------
     t
    (1 row)
    

  7. 查询query_band关联的负载行为。

    1
    2
    3
    4
    5
    6
    SELECT * FROM pg_queryband_action;
        qband     | respool_id | respool | priority | qborder
    --------------+------------+---------+----------+---------
     AppName=test |          0 | NULL    | low      |      -1
     JobName=abc  |      16754 | p2      | high     |       3
    (2 rows)
    

  8. 取消query_band“JobName=abc”关联的所有负载行为,设置为默认行为即可。

    1
    2
    3
    4
    5
    6
    7
    SELECT * FROM gs_wlm_set_queryband_action('JobName=abc','respool=null;priority=medium',-1);
    NOTICE:  The respool of query_band(JobName=abc) will be removed.
    NOTICE:  The priority of query_band(JobName=abc) will be removed.
     gs_wlm_set_queryband_action
    -----------------------------
     t
    (1 row)
    

  9. 查询query_band关联的负载行为。

    1
    2
    3
    4
    5
    SELECT * FROM pg_queryband_action;
        qband     | respool_id | respool | priority | qborder
    --------------+------------+---------+----------+---------
     AppName=test |          0 | NULL    | low      |      -1
    (1 row)
    

support.huaweicloud.com/devg-910-dws/dws_04_0493.html