Snowflake 第 2 代标准仓库

第 2 代标准仓库 (Gen2) 是 Snowflake 中当前标准虚拟仓库的更新版本(“下一代”),专注于提高分析和数据工程工作负载的性能。Gen2 基于更快的基础硬件和智能软件优化而构建,例如对删除、更新和合并操作以及表扫描操作的增强。使用 Gen2,您可以期望大多数查询可以更快地完成,并且可以同时完成更多工作。确切的细节取决于您的配置和工作负载。进行测试以验证此功能在多大程度上优化了您的成本和/或性能。

You can specify the generation for standard warehouses in the CREATE WAREHOUSE or ALTER WAREHOUSE commands, using either the GENERATION clause or the RESOURCE_CONSTRAINT clause:

Using GENERATION clause (recommended):

  • GENERATION = '1' represents Snowflake's original, industry-leading standard virtual warehouses.

  • GENERATION = '2' represents the next generation of Snowflake's standard virtual warehouses.

Using RESOURCE_CONSTRAINT clause:

  • STANDARD_GEN_1 代表 Snowflake 原生、业界领先的标准虚拟仓库。

  • STANDARD_GEN_2 代表下一代 Snowflake 标准虚拟仓库。

备注

Currently, the GENERATION clause and the STANDARD_GEN_1 and STANDARD_GEN_2 values aren't available in Snowsight. You must specify them with SQL commands.

第 2 代标准仓库不适用于仓库规模 X5LARGE 和 X6LARGE。

此功能适用于标准仓库。它不适用于 Snowpark-Optimized Warehouses。

STANDARD_GEN_1 为标准仓库提供的内存容量与 MEMORY _1X 为 Snowpark-Optimized Warehouses 提供的内存容量相同。

标准仓库 RESOURCE_CONSTRAINT 的默认值

对于以下区域,任何与 2025 年 6 月 27 日之后创建的新组织关联的账户,其标准仓库将默认设置为 Gen2:

  • AWS US 西部(俄勒冈州)

  • AWS EU (法兰克福)

  • Azure 东部 US 2(弗吉尼亚)

  • Azure 欧洲西部(荷兰)

对于所有其他提供 Gen2 仓库的区域,2025 年 7 月 15 日之后创建的所有新组织,其标准仓库将默认设置为 Gen2。有关区域可用性的信息,请参阅 区域可用性

For any regions or organizations where the preceding factors don't apply, if you don't specify the GENERATION or RESOURCE_CONSTRAINT clause when you create a standard warehouse, Snowflake creates a Gen1 standard warehouse.

将仓库更改为第 2 代仓库或从第 2 代仓库中移出

You can alter a standard warehouse and specify a different GENERATION clause or RESOURCE_CONSTRAINT clause to change it from generation 1 to generation 2, or from generation 2 to generation 1. You can make that change whether the warehouse is running or suspended.

You can also switch between a Gen2 standard warehouse and a Snowpark-optimized warehouse by changing the value of the WAREHOUSE_TYPE and RESOURCE_CONSTRAINT clauses. You can make that change whether the warehouse is running or suspended. Note that the GENERATION clause applies only to standard warehouses and cannot be used with Snowpark-optimized warehouses.

备注

When you convert a Gen1 warehouse to Gen2 without suspending it first, existing queries that were running on Gen1 continue to run to completion using the Gen1 compute resources. At the same time, the warehouse runs any new queries on the Gen2 compute resources. While the existing queries are running, you are charged for both sets of compute resources. The warehouse doesn't automatically suspend during this period, whether or not any queries are using the Gen2 compute resources. When the existing queries complete, the workload shifts entirely to the Gen2 compute resources. Therefore, you can maximize availability by converting the warehouse while it's running. Or, you can reduce costs by converting the warehouse while it's suspended and no queries are running.

The same consideration applies to converting between standard and Snowpark-optimized warehouses, or any other change to the RESOURCE_CONSTRAINT property. Existing queries will complete on the warehouse they began on and with the RESOURCE_CONSTRAINT that was in effect at the initialization of the query, while new queries will operate on the new warehouse type or the new RESOURCE_CONSTRAINT that you set.

您可以在 SHOW WAREHOUSES 输出的 "resource_constraint" 列中查看标准仓库的设置。

此设置未反映在仓库的 INFORMATION_SCHEMA 视图中。

区域可用性

Gen2 标准仓库适用于 Amazon Web Services (AWS)、Microsoft Azure 和 Google Cloud Platform (GCP) 云服务提供商 (CSPs)。

Gen2 标准仓库在所有 CSP 区域 都可用,但有一些例外。目前,Gen2 标准仓库在这些 CSP 区域 可用:

  • AWS EU (苏黎世)

  • AWS 非洲(开普敦)

  • GCP 中东中部 2(达曼)

  • Azure US 政府弗吉尼亚州 (FedRAMP High Plus)

  • Azure US 政府弗吉尼亚州

重要

如果您对仓库使用账户复制功能,并且创建了任何 Gen2 仓库,则任何次要区域也必须支持 Gen2 仓库。否则,故障转移后,Gen2 仓库可能无法在次要区域中恢复。确保测试任何 Gen2 仓库都可以在次要区域恢复。

根据 Gen2 标准仓库的可用性,Snowflake 标准仓库的默认值正在发生变更。目前,该 RESOURCE_CONSTRAINT 属性的默认值取决于您的组织和账户的 CSP 区域。有关更多信息,请参阅 标准仓库 RESOURCE_CONSTRAINT 的默认值

Gen2 标准仓库的成本和计费

有关 Snowflake 虚拟仓库 credit 使用情况的一般信息,请参阅 虚拟仓库 Credit 使用量

有关 Gen2 标准仓库 Credit 使用量的信息,请参阅 Snowflake 服务使用量表

示例

以下示例显示了在创建新仓库或更改现有仓库时如何指定 Gen2 标准仓库。这些示例展示了相关变化,例如同时更改仓库规模、类型和内存容量。

Examples using RESOURCE_CONSTRAINT clause

The following example creates a Gen2 warehouse using the RESOURCE_CONSTRAINT syntax:

CREATE OR REPLACE WAREHOUSE next_generation_default_size
  RESOURCE_CONSTRAINT = STANDARD_GEN_2;
Copy

以下示例创建了规模为 SMALL 的 Gen2 标准仓库。

CREATE OR REPLACE WAREHOUSE next_generation_size_small
  RESOURCE_CONSTRAINT = STANDARD_GEN_2
  WAREHOUSE_SIZE = SMALL;
Copy

Examples of converting between generations

The following example shows how to convert a generation 1 standard warehouse to generation 2. The warehouse size remains the same, XLARGE, throughout the operation. This example uses the GENERATION clause (recommended):

CREATE OR REPLACE WAREHOUSE old_to_new_xlarge_gen
  WAREHOUSE_SIZE = XLARGE;

ALTER WAREHOUSE old_to_new_xlarge_gen
  SET GENERATION = '2';
Copy

The following example shows the same conversion using the RESOURCE_CONSTRAINT clause:

CREATE OR REPLACE WAREHOUSE old_to_new_xlarge
  WAREHOUSE_SIZE = XLARGE;

ALTER WAREHOUSE old_to_new_xlarge
  SET RESOURCE_CONSTRAINT = STANDARD_GEN_2;
Copy

Examples of converting to or from Snowpark-optimized warehouses

以下示例说明如何将 Gen2 标准仓库转换为 Snowpark 优化型。Snowpark-Optimized Warehouses 目前不能作为 Gen2 仓库使用。因为该仓库的类型为 STANDARD 时,其规模为 XSMALL,所以我们指定 MEMORY_1X 的值为 RESOURCE_CONSTRAINT。该 RESOURCE_CONSTRAINT 产生的内存大小与 XSMALL 规模的 Snowpark-Optimized Warehouses 兼容。

CREATE OR REPLACE WAREHOUSE gen2_to_snowpark_optimized
  RESOURCE_CONSTRAINT = STANDARD_GEN_2;

ALTER WAREHOUSE gen2_to_snowpark_optimized
  SET WAREHOUSE_TYPE = 'SNOWPARK-OPTIMIZED' RESOURCE_CONSTRAINT = MEMORY_1X;
Copy

以下示例说明如何将 Snowpark-Optimized Warehouses 转换为标准的 Gen2 仓库。Snowpark-Optimized Warehouses 从规模 MEDIUM 和相对较大的内存容量(以 MEMORY_16X 的 RESOURCE_CONSTRAINT 值表示)开始。变更后,仓库类型为 STANDARD,规模仍然为 MEDIUM。但是,它的内存容量较低。这是因为 STANDARD_GEN_2 的 RESOURCE_CONSTRAINT 值与资源限制为 MEMORY_1X 的 Snowpark-Optimized Warehouses 具有相同的内存容量。

CREATE OR REPLACE WAREHOUSE snowpark_optimized_medium_to_gen2
  WAREHOUSE_TYPE = 'SNOWPARK-OPTIMIZED'
  WAREHOUSE_SIZE = MEDIUM
  RESOURCE_CONSTRAINT = MEMORY_16X;

ALTER WAREHOUSE snowpark_optimized_medium_to_gen2
  SET WAREHOUSE_TYPE = STANDARD GENERATION = '2';
Copy
语言: 中文