快速入门:使用 T-SQL 创建工作负荷分类器Quickstart: Create a workload classifier using T-SQL

在本快速入门中,我们将为组织的 CEO 快速创建一个具有较高重要性的工作负荷分类器。In this quickstart, you'll quickly create a workload classifier with high importance for the CEO of your organization. 此工作负荷分类器允许 CEO 查询的优先级高于队列中重要性更低的其他查询。This workload classifier will allow CEO queries to take precedence over other queries with lower importance in the queue.

如果没有 Azure 订阅,请在开始前创建一个试用帐户If you don't have an Azure subscription, create a trial account before you begin.

备注

在 Azure Synapse Analytics 中创建一个 Synapse SQL 池实例可能会产生一个新的可计费服务。Creating a Synapse SQL pool instance in Azure Synapse Analytics may result in a new billable service. 有关详细信息,请参阅 Azure Synapse Analytics 定价For more information, see Azure Synapse Analytics pricing.

先决条件Prerequisites

本快速入门假设你已有 SQL 数据仓库,并且具有 CONTROL DATABASE 权限。This quickstart assumes you already have a SQL Data Warehouse and that you have CONTROL DATABASE permissions. 如果需要创建一个 SQL 数据仓库,可使用创建并连接 - 门户创建名为“mySampleDataWarehouse”的数据仓库 。If you need to create one, use Create and Connect - portal to create a data warehouse called mySampleDataWarehouse.

登录到 Azure 门户Sign in to the Azure portal

登录到 Azure 门户Sign in to the Azure portal.

为 TheCEO 创建登录名Create login for TheCEO

使用 CREATE LOGINmaster 数据库中为“TheCEO”创建 SQL Server 身份验证登录名。Create a SQL Server authentication login in the master database using CREATE LOGIN for 'TheCEO'.

IF NOT EXISTS (SELECT * FROM sys.sql_logins WHERE name = 'TheCEO')
BEGIN
CREATE LOGIN [TheCEO] WITH PASSWORD='<strongpassword>'
END
;

创建用户Create user

在 mySampleDataWarehouse 中创建用户“TheCEO”Create user, "TheCEO", in mySampleDataWarehouse

IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = 'THECEO')
BEGIN
CREATE USER [TheCEO] FOR LOGIN [TheCEO]
END
;

创建工作负荷分类器Create a workload classifier

为“TheCEO”创建具有较高重要性的工作负荷分类器Create a workload classifier for "TheCEO" with high importance.

DROP WORKLOAD CLASSIFIER [wgcTheCEO];
CREATE WORKLOAD CLASSIFIER [wgcTheCEO]
WITH (WORKLOAD_GROUP = 'xlargerc'
      ,MEMBERNAME = 'TheCEO'
      ,IMPORTANCE = HIGH);

查看现有分类器View existing classifiers

SELECT * FROM sys.workload_management_workload_classifiers

清理资源Clean up resources

DROP WORKLOAD CLASSIFIER [wgcTheCEO]
DROP USER [TheCEO]
;

我们会针对数据仓库中存储的数据,按数据仓库单位收费。You're being charged for data warehouse units and data stored in your data warehouse. 这些计算和存储资源是分开计费的。These compute and storage resources are billed separately.

  • 如果想要将数据保留在存储中,可以在不使用数据仓库时暂停计算。If you want to keep the data in storage, you can pause compute when you aren't using the data warehouse. 如果暂停计算资源,则你只需支付数据存储费用。By pausing compute, you're only charged for data storage. 准备好处理数据时,可以恢复计算。When you're ready to work with the data, resume compute.
  • 如果不想支付将来的费用,则可以删除数据仓库。If you want to remove future charges, you can delete the data warehouse.

遵循以下步骤清理资源。Follow these steps to clean up resources.

  1. 登录到 Azure 门户,选择你的数据仓库。Sign in to the Azure portal, select on your data warehouse.

    清理资源

  2. 若要暂停计算,请选择“暂停” 按钮。To pause compute, select the Pause button. 暂停数据仓库后,可看到“启动” 按钮。When the data warehouse is paused, you see a Start button. 若要恢复计算,请选择“启动” 。To resume compute, select Start.

  3. 若要删除数据仓库以免产生计算或存储费用,请选择“删除” 。To remove the data warehouse so you're not charged for compute or storage, select Delete.

  4. 若要删除所创建的 SQL 服务器,请选择上图中的“mynewserver-20180430.database.chinacloudapi.cn”,然后选择“删除” 。To remove the SQL server you created, select mynewserver-20180430.database.chinacloudapi.cn in the previous image, and then select Delete. 请谨慎执行此删除操作,因为删除服务器的同时也会删除分配给该服务器的所有数据库。Be careful with this deletion, since deleting the server also deletes all databases assigned to the server.

  5. 若要删除资源组,请选择“myResourceGroup” ,然后选择“删除资源组” 。To remove the resource group, select myResourceGroup, and then select Delete resource group.

后续步骤Next steps