Resource group assignments
Each user is assigned to exactly one resource group. When GRA is used, this resource group determines the amount of resources that are to be made available to process a query that was submitted by that user.
In addition to being assigned to a resource group, each user can be a member of any number of user groups. However, a user's membership in a user group, even a user group that is itself a resource group, does not affect that user's resource group assignment. The resource group assignment is determined solely by the nzsql CREATE USER and ALTER USER commands; it is not affected by assignments made during a CREATE GROUP or ALTER GROUP command. A user can even be assigned to a resource group of which that user is not a member. For example:
-
The following command creates a user account with the name bob and assigns bob to the rptusers resource group:
If no resource group were specified for this CREATE USER command, bob would be assigned to the public resource group.CREATE USER bob WITH PASSWORD 'test96' IN RESOURCEGROUP rptusers;
-
The following CREATE GROUP command creates the analysts user group, specifies a nonzero resource minimum (which means that the user group is a resource group), and assigns bob to that group:
However, this command does not change bob's resource group assignment, which remains to the rptusers resource group.CREATE GROUP analysts WITH RESOURCE MINIMUM 50 USER bob;
-
The following ALTER GROUP command drops bob from the rptusers user group:
However, this command does not change bob's resource group assignment, which remains to the rptusers resource group.ALTER GROUP rptusers DROP USER bob;
-
The following command changes bob's resource group assignment to the analysts resource group:
ALTER USER bob IN RESOURCEGROUP analysts;
For each of these commands, the specified resource group must already exist; that is, there must be a user group with that name and it must have a nonzero resource minimum.
After you assign a user to a resource group, you cannot change the resource minimum of that resource group to 0. If you drop a resource group, users who are assigned to it are reassigned to the public resource group.
ALTER USER bob IN RESOURCEGROUP public;