How to: Drop a Workload Group (Transact-SQL)

This topic shows how you can use Transact-SQL to drop a workload group from a resource pool. Dropping a group is a two-step process that uses the DROP WORKLOAD GROUP command and the ALTER RESOURCE GOVERNOR command. The following procedure uses groupAdhoc as an example.

To drop a workload group

  1. Execute the following statement:

    DROP WORKLOAD GROUP groupAdhoc
    GO
    
  2. Before you issue the ALTER RESOURCE GOVERNOR RECONFIGURE statement, verify that there are no active requests in groupAdhoc. If there are active requests, ALTER RESOURCE GOVERNOR will fail. To avoid this issue, you can take one of the following actions:

    • Wait until all the sessions from the workload group have disconnected.

    • Explicitly stop sessions in the workload group by using the KILL command.

    • Restart the server. The workload group will not be re-created.

    • In a scenario in which you have issued the DROP WORKLOAD GROUP statement but decide that you do not want to explicitly stop sessions to apply the change, you can re-create the group by using the same name that it had before you issued the DROP statement, and then move the group to the original resource pool.

  3. Execute the following statement:

    ALTER RESOURCE GOVERNOR RECONFIGURE
    GO