GaussDB(DWS) implements load identification and intra-queue priority control based on query_band. It provides more flexible load identification methods and identifies load queues based on job types, application names, and script names. Users can flexibly configure query_band identification queues based on service scenarios. In addition, priority control of job delivery in the queue is implemented. In the future, priority control of resources in the queue will be gradually implemented.
Administrators can configure the queue associated with query_band and estimate the memory limit based on service scenarios and job types to implement more flexible load control and resource management and control. If query_band is not configured for the service or the user does not associate query_band with an action, the queue associated with the user and the priority in the queue is used by default.
query_band is a session-level GUC parameter. It is a job identifier of the character data type. Its value can be any string. However, for easier differentiation and configuration, query_band only identifies key-value pairs. For example:
1 | SET query_band='JobName=abc;AppName=test;UserName=user'; |
JobName=abc, AppName=test, and UserName=user are independent key-value pairs. Specifications of the query_band key-value pairs:
query_band is configured, and identifies load behaviors, using key-value pairs. The supported load behaviors are described in Table 1.
Type |
Behavior |
Behavior Description |
|---|---|---|
Workload management (workload) |
Resource pool (respool) |
query_band associated with a resource pool |
Workload management (workload) |
Priority |
Priority in the queue |
Order |
Queue (respool) Currently, this field is invalid and is used for future extension. |
query_band query order |
The "Type" is used to classify load behaviors. Different load behaviors may belong to a same type. For example, both "Resource pool" and a "Priority" belong to "Workload management". The "Behavior" indicates a load behavior associated with a query_band key-value pair. The "Behavior description" describes a specific load behavior. The "Order" in the "Type" is used to indicate the priority of the query_band load behavior identification. When a session has multiple query_band key-value pairs, the query_band key-value pair with a smaller order value is preferentially used to identify a load behavior. Each query_band key-value pair can have multiple associated load behaviors, while one load behavior can only have one associated key-value pair. The query_band load behavior is described as follows:
The intra-queue priority is used to implement the queuing priority.
The preceding priority queues comply with the following scheduling rules:
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) |
1 2 3 4 5 | SELECT * FROM gs_wlm_set_queryband_action('JobName=abc','respool=p2'); gs_wlm_set_queryband_action ----------------------------- t (1 row) |
1 2 3 4 5 | SELECT * FROM gs_wlm_set_queryband_action('JobName=abc','priority=high'); gs_wlm_set_queryband_action ----------------------------- t (1 row) |
1 2 3 4 5 | SELECT * FROM gs_wlm_set_queryband_order('JobName=abc',3); gs_wlm_set_queryband_order ----------------------------- t (1 row) |
1 2 3 4 5 | SELECT * FROM pg_queryband_action; qband | respool_id | respool | priority | qborder --------------+------------+---------+----------+--------- JobName=abc | 17119 | p2 | high | 1 (1 row) |
1 2 3 4 5 | SELECT * FROM gs_wlm_set_queryband_action('AppName=test','priority=low'); gs_wlm_set_queryband_action ----------------------------- t (1 row) |
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) |
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) |
1 2 3 4 5 | SELECT * FROM pg_queryband_action; qband | respool_id | respool | priority | qborder --------------+------------+---------+----------+--------- AppName=test | 0 | NULL | low | -1 (1 row) |