快速入门:使用 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 中创建专用 SQL 池实例可能会产生一个新的可计费服务。Creating a dedicated 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

本快速入门假定你已在 Azure Synapse Analytics 中预配专用 SQL 池,并且具有 CONTROL DATABASE 权限。This quickstart assumes you have already provisioned a dedicated SQL pool in Azure Synapse Analytics and that you have CONTROL DATABASE permissions. 如果需要创建一个 SQL 池,请参考创建和连接 - 门户创建名为 mySampleDataWarehouse 的专用 SQL 池。If you need to create one, use Create and Connect - portal to create a dedicated SQL pool 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]
;

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

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

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

  1. 登录到 Azure 门户,选择你的专用 SQL 池。Sign in to the Azure portal, select your dedicated SQL pool.

    清理资源

  2. 若要暂停计算,请选择“暂停” 按钮。To pause compute, select the Pause button. 暂停专用 SQL 池后,会看到“启动”按钮。When the dedicated SQL pool is paused, you see a Start button. 若要恢复计算,请选择“启动” 。To resume compute, select Start.

  3. 若要删除专用 SQL 池以免产生计算或存储费用,请选择“删除”。To remove the dedicated SQL pool so you're not charged for compute or storage, select Delete.

后续步骤Next steps