WLM queue assignment rules
When a user runs a query, WLM assigns the query to the first matching queue, based on the WLM queue assignment rules:
-
If a user is logged in as a superuser and runs a query in the query group labeled superuser, the query is assigned to the superuser queue.
-
If a user is part of a role, belongs to a listed user group, or runs a query within a listed query group, the query is assigned to the first matching queue.
-
If a query doesn't meet any criteria, the query is assigned to the default queue, which is the last queue defined in the WLM configuration.
The following diagram illustrates how these rules work.
![Flowchart showing decision process for assigning users to queues based on superuser status and matching criteria.](/images/redshift/latest/dg/images/queue-assignment-rules-with-rbac.png)
Queue assignments example
The following table shows a WLM configuration with the superuser queue and four user-defined queues.
Queue | Concurrency | User Roles | User Groups | Query Groups |
---|---|---|---|---|
Superuser |
1 |
superuser |
||
1 |
5 |
test_db_rw |
UG_1 |
|
2 |
5 |
QG_B |
||
3 |
5 |
UG_2 |
QG_C |
|
Default |
5 |
The following illustration shows how queries are assigned to the queues in the previous table according to user groups and query groups. For information about how to assign queries to user groups and query groups at runtime, see Assigning queries to queues later in this section.
![Diagram showing query assignments to different queues based on user groups and query groups.](/images/redshift/latest/dg/images/queues-assignment-2.png)
In this example, WLM makes the following assignments:
-
The first set of statements shows three ways to assign users to user groups. The statements are run by the user
adminuser
, which is not a member of a user group listed in any WLM queue. No query group is set, so the statements are routed to the default queue. -
The user
adminuser
is a superuser and the query group is set to'superuser'
, so the query is assigned to the superuser queue. -
The user
test_user
is assigned the roletest_db_rw
listed in queue 1, so the query is assigned to queue 1. -
The user
admin1
is a member of the user group listed in queue 1, so the query is assigned to queue 1. -
The user
vp1
is not a member of any listed user group. The query group is set to'QG_B'
, so the query is assigned to queue 2. -
The user
analyst1
is a member of the user group listed in queue 3, but'QG_B'
matches queue 2, so the query is assigned to queue 2. -
The user
ralph
is not a member of any listed user group and the query group was reset, so there is no matching queue. The query is assigned to the default queue.