DROP RESOURCE GROUP

Delete the resource group.

Summary

DROP RESOURCE GROUP group_name

describe

This command deletes the resource group from the YMatrix database. Only superusers can delete resource groups. When a resource group is deleted, the memory and CPU resources retained by the group are recycled to the YMatrix database.

To delete a role resource group, you cannot assign the group to any roles, and you cannot have any pending or running statements in the group. If you delete a resource group created for an external component, the behavior is determined by the external component. For example, deleting a resource group assigned to the PL/Container runtime kills the running containers in the group.

You cannot delete predefined admin_group and default_group resource groups.

Parameters

group_name

  • The name of the resource group to be deleted.

Note

You cannot submit a DROP RESOURCE GROUP command in an explicit transaction or a subtransaction.

Use ALTER ROLE to delete resource groups assigned to specific users/role.

Perform the following query to view all currently active queries for all resource groups:

SELECT usename, current_query, waiting, procpid,
    rsgid, rsgname, rsgqueueduration
  FROM pg_stat_activity;

To view resource group allocation, perform the following query on the pg_roles and pg_resgroup system catalog tables:

SELECT rolname, rsgname
  FROM pg_roles, pg_resgroup
  WHERE pg_roles.rolresgroup=pg_resgroup.oid;

Example

Delete the resource group assigned to the role. This action then assigns the default resource group default_group to the role:

ALTER ROLE bob RESOURCE GROUP NONE;

Delete the resource group named adhoc:

DROP RESOURCE GROUP adhoc;

compatibility

The DROP RESOURCE GROUP statement is a YMatrix database extension.

See also

ALTER RESOURCE GROUP, CREATE RESOURCE GROUP