> ## Documentation Index
> Fetch the complete documentation index at: https://docs.snowflake.com/llms.txt
> Use this file to discover all available pages before exploring further.

# CREATE WAREHOUSE

Creates a new [virtual warehouse](/user-guide/warehouses-overview) in the system.

Initial creation of a virtual warehouse might take some time to provision the compute resources, unless the warehouse is created initially
in a `SUSPENDED` state.

This command supports the following variants:

- [](#label-create-or-alter-warehouse-syntax): Creates a new warehouse if it doesn't exist or alters an existing warehouse.

<dl>
<dt>See also:</dt>
<dd>

[](/sql-reference/sql/alter-warehouse), [](/sql-reference/sql/desc-warehouse), [](/sql-reference/sql/drop-warehouse), [](/sql-reference/sql/show-warehouses)

</dd>
</dl>

## Syntax

```sqlsyntax
CREATE [ OR REPLACE ] WAREHOUSE [ IF NOT EXISTS ] <name>
       [ [ WITH ] objectProperties ]
       [ [ WITH ] TAG ( <tag_name> = '<tag_value>' [ , <tag_name> = '<tag_value>' , ... ] ) ]
       [ objectParams ]
```

Where:

<blockquote>

```sqlsyntax
objectProperties ::=
  WAREHOUSE_TYPE = { STANDARD | 'SNOWPARK-OPTIMIZED' | ADAPTIVE }
  WAREHOUSE_SIZE = { XSMALL | SMALL | MEDIUM | LARGE | XLARGE | XXLARGE | XXXLARGE | X4LARGE | X5LARGE | X6LARGE }
  GENERATION = { '1' | '2' }
  RESOURCE_CONSTRAINT = { STANDARD_GEN_1 | STANDARD_GEN_2 | MEMORY_1X | MEMORY_1X_x86 | MEMORY_16X | MEMORY_16X_x86 | MEMORY_64X | MEMORY_64X_x86 }
  MAX_CLUSTER_COUNT = <num>
  MIN_CLUSTER_COUNT = <num>
  SCALING_POLICY = { STANDARD | ECONOMY }
  AUTO_SUSPEND = { <num> | NULL }
  AUTO_RESUME = { TRUE | FALSE }
  INITIALLY_SUSPENDED = { TRUE | FALSE }
  RESOURCE_MONITOR = <monitor_name>
  COMMENT = '<string_literal>'
  ENABLE_QUERY_ACCELERATION = { TRUE | FALSE }
  QUERY_ACCELERATION_MAX_SCALE_FACTOR = <num>
```

```sqlsyntax
objectParams ::=
  MAX_CONCURRENCY_LEVEL = <num>
  STATEMENT_QUEUED_TIMEOUT_IN_SECONDS = <num>
  STATEMENT_TIMEOUT_IN_SECONDS = <num>
```

</blockquote>

## Variant syntax

<a id="label-create-or-alter-warehouse-syntax"></a>

### CREATE OR ALTER WAREHOUSE

This feature is not available in the People's Republic of China.

Creates a new warehouse if it doesn't already exist, or transforms an existing warehouse into the warehouse defined in the statement.
A CREATE OR ALTER WAREHOUSE statement follows the syntax rules of a CREATE WAREHOUSE statement and has the same limitations as an
[](/sql-reference/sql/alter-warehouse) statement.

The following modifications are supported when altering a warehouse:

- Changing warehouse properties and parameters. For example, WAREHOUSE_TYPE, AUTO_RESUME or MAX_CLUSTER_COUNT.

For more information, see [](#label-create-or-alter-warehouse-usage-notes) and [](/sql-reference/sql/create-or-alter).

```sql
CREATE OR ALTER WAREHOUSE <name>
     [ [ WITH ] objectProperties ]
     [ objectParams ]

objectProperties ::=
  WAREHOUSE_TYPE = { STANDARD | 'SNOWPARK-OPTIMIZED' | ADAPTIVE }
  WAREHOUSE_SIZE = { XSMALL | SMALL | MEDIUM | LARGE | XLARGE | XXLARGE | XXXLARGE | X4LARGE | X5LARGE | X6LARGE }
  GENERATION = { '1' | '2' }
  RESOURCE_CONSTRAINT = { STANDARD_GEN_1 | STANDARD_GEN_2 | MEMORY_1X | MEMORY_1X_x86 | MEMORY_16X | MEMORY_16X_x86 | MEMORY_64X | MEMORY_64X_x86 }
  MAX_CLUSTER_COUNT = <num>
  MIN_CLUSTER_COUNT = <num>
  SCALING_POLICY = { STANDARD | ECONOMY }
  AUTO_SUSPEND = { <num> | NULL }
  AUTO_RESUME = { TRUE | FALSE }
  INITIALLY_SUSPENDED = { TRUE | FALSE }
  RESOURCE_MONITOR = <monitor_name>
  COMMENT = '<string_literal>'
  ENABLE_QUERY_ACCELERATION = { TRUE | FALSE }
  QUERY_ACCELERATION_MAX_SCALE_FACTOR = <num>

objectParams ::=
  MAX_CONCURRENCY_LEVEL = <num>
  STATEMENT_QUEUED_TIMEOUT_IN_SECONDS = <num>
  STATEMENT_TIMEOUT_IN_SECONDS = <num>
```

## Required parameters

<dl>
<dt><code className="samp"><em>name</em></code></dt>
<dd>

Identifier for the virtual warehouse; must be unique for your account.

In addition, the identifier must start with an alphabetic character and can't contain spaces or special characters unless the entire
identifier string is enclosed in double quotes (for example, `"My object"`). Identifiers enclosed in double quotes are also case-sensitive.

For more details, see [](/sql-reference/identifiers-syntax).

</dd>
</dl>

## Optional properties (`objectProperties`)

<dl>
<dt>`WAREHOUSE_TYPE = { STANDARD | 'SNOWPARK-OPTIMIZED' | ADAPTIVE }`</dt>
<dd>

Specifies the warehouse type.

<dl className="field-list">
<dt>Valid values<span className="colon">:</span></dt>
<dd>

- `STANDARD`, `'STANDARD'`
- `'SNOWPARK-OPTIMIZED'`
- `ADAPTIVE`, `'ADAPTIVE'`

</dd>
<dt>Default<span className="colon">:</span></dt>
<dd>

`STANDARD`

</dd>
</dl>

- To use a value that contains a hyphen (`'SNOWPARK-OPTIMIZED'`), you must enclose the value in single quotes, as shown.
- For [Adaptive Warehouses](/user-guide/warehouses-adaptive), use `ADAPTIVE`. See
  [](/user-guide/warehouses-adaptive#label-create-adaptive-warehouse-syntax) for supported properties.

</dd>
<dt>`WAREHOUSE_SIZE = \{ XSMALL | SMALL | MEDIUM | LARGE | XLARGE | XXLARGE | XXXLARGE | X4LARGE | X5LARGE | X6LARGE \}`</dt>
<dd>

Specifies the size of the virtual warehouse. The size determines the amount of compute resources in each cluster in the warehouse and,
therefore, the number of credits consumed while the warehouse is running.

<dl className="field-list">
<dt>Valid values<span className="colon">:</span></dt>
<dd>

<div className="colwidths-given">

  <colgroup>
    <col style={{width: "37.5%"}} />
    <col style={{width: "62.5%"}} />
  </colgroup>
  <thead>
    <tr>
      <th>Supported Values</th>
      <th>Synonyms</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>`XSMALL`</td>
      <td>`'X-SMALL'`</td>
    </tr>
    <tr>
      <td>`SMALL`</td>
      <td></td>
    </tr>
    <tr>
      <td>`MEDIUM`</td>
      <td></td>
    </tr>
    <tr>
      <td>`LARGE`</td>
      <td></td>
    </tr>
    <tr>
      <td>`XLARGE`</td>
      <td>`'X-LARGE'`</td>
    </tr>
    <tr>
      <td>`XXLARGE`</td>
      <td>`X2LARGE`, `'2X-LARGE'`</td>
    </tr>
    <tr>
      <td>`XXXLARGE`</td>
      <td>`X3LARGE`, `'3X-LARGE'`</td>
    </tr>
    <tr>
      <td>`X4LARGE`</td>
      <td>`'4X-LARGE'`</td>
    </tr>
    <tr>
      <td>`X5LARGE`</td>
      <td>`'5X-LARGE'`</td>
    </tr>
    <tr>
      <td>`X6LARGE`</td>
      <td>`'6X-LARGE'`</td>
    </tr>
    <tr>
      <td>

<dl className="field-list">
<dt>Default<span className="colon">:</span></dt>
<dd>

`XSMALL`

</dd>
</dl>

</td>
    </tr>
  </tbody>

</div>

- X5LARGE and X6LARGE sizes for Snowpark-optimized warehouses are only supported with the MEMORY_16X resource constraint.
- X5LARGE and X6LARGE sizes aren't supported for standard warehouses that use the STANDARD_GEN_2 resource constraint.
- The default size for Snowpark-optimized warehouses is MEDIUM.
- To use a value that contains a hyphen (for example, `'2X-LARGE'`), you must enclose the value in single quotes, as shown.

</dd>
</dl>

</dd>
<dt>`GENERATION = { '1' | '2' }`</dt>
<dd>

Specifies the warehouse generation for standard warehouses. This parameter provides a simplified way to set the warehouse generation,
instead of using RESOURCE_CONSTRAINT = STANDARD_GEN_1 or STANDARD_GEN_2.

<dl className="field-list">
<dt>Valid values<span className="colon">:</span></dt>
<dd>

- `'1'`: Uses generation 1 compute resources. Equivalent to
  `RESOURCE_CONSTRAINT = STANDARD_GEN_1`.
- `'2'`: Uses generation 2 compute resources. Equivalent to
  `RESOURCE_CONSTRAINT = STANDARD_GEN_2`.

</dd>
<dt>Default<span className="colon">:</span></dt>
<dd>

`'2'` (generation 2 compute resources)

</dd>
</dl>

- Values must be enclosed in single quotes (for example, `'1'`, not `1`).
- GENERATION applies only to standard warehouses (`WAREHOUSE_TYPE = STANDARD`).
- When both GENERATION and RESOURCE_CONSTRAINT are specified, any mismatch results in an error.
- You can't use GENERATION with Snowpark-optimized warehouses or memory-based resource constraints (MEMORY_1X, MEMORY_16X, MEMORY_64X).

</dd>
</dl>

`RESOURCE_CONSTRAINT = { STANDARD_GEN_1 | STANDARD_GEN_2 | MEMORY_1X | MEMORY_1X_x86 | MEMORY_16X | MEMORY_16X_x86 | MEMORY_64X | MEMORY_64X_x86 }`

<blockquote>

<div className="previewfeat sidebar">

<div className="sidebar-title">

%logo-snowflake-black% [Preview Feature](/release-notes/preview-features) — Open

</div>

The 1 TB resource constraints (MEMORY_64X and MEMORY_64X_x86) are available as a preview feature.
The 1 TB constraints are available only on the Amazon Web Services (AWS) cloud platform.

All other MEMORY\_\* resource constraint sizes are generally available and are available for all cloud platforms.

All resource constraints other than the default MEMORY_16X resource constraint are not supported in the People's Republic of China.

</div>

Specifies the memory and CPU architecture for [Snowpark-optimized warehouses](/user-guide/warehouses-snowpark-optimized),
or generation 1 or [generation 2 capabilities for standard warehouses](/user-guide/warehouses-gen2).

The following table includes the valid values for the property, available memory, CPU architecture, and the minimum warehouse
size required for the `resource_constraint` setting.
For more information about regions and cloud service providers where generation 2 standard warehouses
are available, see [Snowflake generation 2 standard warehouses](/user-guide/warehouses-gen2).

<blockquote>

<dl>
<dt>Valid values<span className="colon">:</span></dt>
<dd>

</dd>
</dl>

<div className="colwidths-given">

  <colgroup>
    <col style={{ width: "27.3%" }} />
    <col style={{ width: "18.2%" }} />
    <col style={{ width: "18.2%" }} />
    <col style={{ width: "18.2%" }} />
    <col style={{ width: "18.2%" }} />
  </colgroup>
  <thead>
    <tr>
      <th>Value</th>
      <th>Memory (up to)</th>
      <th>CPU architecture</th>
      <th>Min warehouse size required</th>
      <th>Max warehouse size</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>`STANDARD_GEN_1`</td>
      <td>16 GB</td>
      <td>Standard</td>
      <td>XSMALL</td>
      <td>X6LARGE</td>
    </tr>
    <tr>
      <td>`STANDARD_GEN_2`</td>
      <td>16 GB</td>
      <td>Standard (generation 2)</td>
      <td>XSMALL</td>
      <td>X4LARGE</td>
    </tr>
    <tr>
      <td>`MEMORY_1X`</td>
      <td>16 GB</td>
      <td>Standard</td>
      <td>XSMALL</td>
      <td>X4LARGE</td>
    </tr>
    <tr>
      <td>`MEMORY_1X_x86`</td>
      <td>16 GB</td>
      <td>x86</td>
      <td>XSMALL</td>
      <td>X4LARGE</td>
    </tr>
    <tr>
      <td>`MEMORY_16X`</td>
      <td>256 GB</td>
      <td>Standard</td>
      <td>MEDIUM</td>
      <td>X6LARGE</td>
    </tr>
    <tr>
      <td>`MEMORY_16X_x86`</td>
      <td>256 GB</td>
      <td>x86</td>
      <td>MEDIUM</td>
      <td>X4LARGE</td>
    </tr>
    <tr>
      <td>`MEMORY_64X`</td>
      <td>1 TB</td>
      <td>Standard</td>
      <td>LARGE</td>
      <td>X4LARGE</td>
    </tr>
    <tr>
      <td>`MEMORY_64X_x86`</td>
      <td>1 TB</td>
      <td>x86</td>
      <td>LARGE</td>
      <td>X4LARGE</td>
    </tr>
  </tbody>

</div>

<dl className="field-list">
<dt>Default value<span className="colon">:</span></dt>
<dd>

`MEMORY_16X` for Snowpark-optimized warehouses. For standard warehouses, the default depends on
Gen2 support for your cloud service provider region and whether your organization was created after
Gen2 support became available in that region. For more information, see
[](#label-gen-2-standard-warehouses-default-generation).

</dd>
</dl>

For standard warehouses, consider using the GENERATION parameter instead of STANDARD_GEN_1 and STANDARD_GEN_2 values.
The GENERATION parameter provides a simpler way to specify the warehouse generation.
Specify `GENERATION = '2'` or `GENERATION = '1'`. The quotes are required around the
generation number.

</blockquote>

</blockquote>

<dl>
<dt><code className="samp">MAX_CLUSTER_COUNT = <em>num</em></code></dt>
<dd>

Specifies the maximum number of clusters for a multi-cluster warehouse. For a single-cluster warehouse, this value is always `1`.

<dl className="field-list">
<dt>Valid values<span className="colon">:</span></dt>
<dd>

`1` to an upper limit that varies depending on warehouse size.

Note that specifying a value greater than `1` indicates the warehouse is a multi-cluster warehouse; however, the value can only be set
to a higher value in [Snowflake Enterprise Edition](/user-guide/intro-editions) (or higher).

For more information, including the upper limit for each warehouse size, see [](/user-guide/warehouses-multicluster).

</dd>
<dt>Default<span className="colon">:</span></dt>
<dd>

`1` (single-cluster warehouse)

</dd>
</dl>

For Snowflake Enterprise Edition (or higher), we recommend always setting the value greater than `1` to help maintain
high-availability and optimal performance of a multi-cluster warehouse. This also helps ensure continuity in the unlikely event that a
cluster fails.

</dd>
<dt><code className="samp">MIN_CLUSTER_COUNT = <em>num</em></code></dt>
<dd>

Specifies the minimum number of clusters for a multi-cluster warehouse (only applies to multi-cluster warehouses).

<dl className="field-list">
<dt>Valid values<span className="colon">:</span></dt>
<dd>

`1` to the value of `MAX_CLUSTER_COUNT`. The upper limit for `MAX_CLUSTER_COUNT` varies depending on the warehouse size.

`MIN_CLUSTER_COUNT` must be equal to or less than `MAX_CLUSTER_COUNT`:

- If both parameters are equal, the warehouse runs in <span className="emph">Maximized</span> mode.
- If `MIN_CLUSTER_COUNT` is less than `MAX_CLUSTER_COUNT`, the warehouse runs in <span className="emph">Auto-scale</span> mode.

For more information, including the upper limit for each warehouse size, see [](/user-guide/warehouses-multicluster).

</dd>
<dt>Default<span className="colon">:</span></dt>
<dd>

`1`

</dd>
</dl>

</dd>
<dt>`SCALING_POLICY = { STANDARD | ECONOMY }`</dt>
<dd>

Specifies the policy for automatically starting and shutting down clusters in a multi-cluster warehouse running in Auto-scale mode.

<dl className="field-list">
<dt>Valid values<span className="colon">:</span></dt>
<dd>

- `STANDARD`: Minimizes queuing by starting clusters.
- `ECONOMY`: Conserves credits by favoring keeping running clusters fully loaded.

For a more detailed description, see [](#label-mcw-scaling-policies).

</dd>
<dt>Default<span className="colon">:</span></dt>
<dd>

`STANDARD`

</dd>
</dl>

</dd>
<dt><code className="samp">AUTO_SUSPEND = &#123; <em>num</em> | NULL &#125;</code></dt>
<dd>

Specifies the number of seconds of inactivity after which a warehouse is automatically suspended.

<dl className="field-list">
<dt>Valid values<span className="colon">:</span></dt>
<dd>

Any integer `0` or greater, or `NULL`:

- The background process that suspends a warehouse runs approximately every 30 seconds and, therefore, the setting for
  this property isn't intended for enabling precise control over warehouse suspension.
- Setting a value less than 30, or a value that isn't a multiple of 30, is allowed but might not result in the expected
  behavior due to the 30-second poll interval for warehouse suspension.
- Setting a `0` or `NULL` value means the warehouse never suspends.

</dd>
<dt>Default<span className="colon">:</span></dt>
<dd>

`600` (the warehouse suspends automatically after 10 minutes of inactivity)

</dd>
</dl>

Setting `AUTO_SUSPEND` to `0` or `NULL` is <span className="emph">not</span> recommended, unless your query workloads require a continually
running warehouse. Note that this can result in significant consumption of credits (and corresponding charges), particularly for
larger warehouses.

</dd>
<dt>`AUTO_RESUME = { TRUE | FALSE }`</dt>
<dd>

Specifies whether to automatically resume a warehouse when a SQL statement (for example, query) is submitted to it.

<dl className="field-list">
<dt>Valid values<span className="colon">:</span></dt>
<dd>

- `TRUE`: The warehouse resumes when a new query is submitted.
- `FALSE`: The warehouse only resumes when explicitly resumed using [](/sql-reference/sql/alter-warehouse) or through the Snowflake web
  interface.

</dd>
<dt>Default<span className="colon">:</span></dt>
<dd>

`TRUE` (the warehouse resumes automatically when a SQL statement is submitted to it)

</dd>
</dl>

</dd>
<dt>`INITIALLY_SUSPENDED = { TRUE | FALSE }`</dt>
<dd>

Specifies whether the warehouse is created initially in the 'Suspended' state.

<dl className="field-list">
<dt>Valid values<span className="colon">:</span></dt>
<dd>

- `TRUE`: The warehouse is created, but suspended.
- `FALSE`: The warehouse starts running after it is created.

</dd>
<dt>Default<span className="colon">:</span></dt>
<dd>

`FALSE`

</dd>
</dl>

</dd>
<dt><code className="samp">RESOURCE_MONITOR = <em>monitor_name</em></code></dt>
<dd>

Specifies the name of a resource monitor that is explicitly assigned to the warehouse. When a resource monitor is explicitly assigned
to a warehouse, the monitor controls the monthly credits used by the warehouse (and all other warehouses to which the monitor is
assigned).

<dl className="field-list">
<dt>Valid values<span className="colon">:</span></dt>
<dd>

Any existing resource monitor.

For more details, see [](/user-guide/resource-monitors).

</dd>
<dt>Default<span className="colon">:</span></dt>
<dd>

No value (no resource monitor assigned to the warehouse)

</dd>
</dl>

To view all resource monitors and their identifiers, use the [](/sql-reference/sql/show-resource-monitors) command.

</dd>
<dt><code className="samp">COMMENT = '<em>string_literal</em>'</code></dt>
<dd>

Specifies a comment for the warehouse.

</dd>
</dl>

<dl>
<dt>`TAG ( tag_name = 'tag_value' [ , tag_name = 'tag_value' , ... ] )`</dt>
<dd>

Specifies the [tag](/user-guide/object-tagging/introduction) name and the tag string value.

The tag value is always a string, and the maximum number of characters for the tag value is 256.

For information about specifying tags in a statement, see [](#label-object-tagging-quota).

</dd>
</dl>

### Query acceleration properties

This feature requires Enterprise Edition (or higher). To inquire about upgrading, please contact [Snowflake Support](https://docs.snowflake.com/user-guide/contacting-support).

<dl>
<dt>`ENABLE_QUERY_ACCELERATION = { TRUE | FALSE }`</dt>
<dd>

Specifies whether to enable the [query acceleration service](/user-guide/query-acceleration-service) for queries that rely on this
warehouse for compute resources.

<blockquote>

<dl className="field-list">
<dt>Valid values<span className="colon">:</span></dt>
<dd>

- `TRUE` Enables Query Acceleration
- `FALSE` Disables Query Acceleration

</dd>
<dt>Default<span className="colon">:</span></dt>
<dd>

- `FALSE` for single-cluster Gen1 warehouses
- `TRUE` for [Gen2](/user-guide/warehouses-gen2) and [multi-cluster](/user-guide/warehouses-multicluster) warehouses

</dd>
</dl>

</blockquote>

</dd>
</dl>

<a id="label-query-acceleration-max-scale-factor"></a>

<code className="samp">QUERY_ACCELERATION_MAX_SCALE_FACTOR = <em>num</em></code>

<blockquote>

Specifies the maximum scale factor for leasing compute resources for query acceleration. The scale factor is used as a multiplier based
on [warehouse size](#label-warehouse-size).

Setting the QUERY_ACCELERATION_MAX_SCALE_FACTOR to 0 eliminates the limit and allows queries to lease as many resources as necessary and
as available to service the query.

Regardless of the QUERY_ACCELERATION_MAX_SCALE_FACTOR value, the amount of available compute resources for query acceleration is bound by
the available resources in the service and the number of other concurrent requests. For more details, refer to
[](#label-query-acceleration-scale-factor).

<dl className="field-list">
<dt>Valid values<span className="colon">:</span></dt>
<dd>

`0` to `100`

</dd>
<dt>Default<span className="colon">:</span></dt>
<dd>

`8`, or `2` when Snowflake automatically enables query acceleration for [Gen2](/user-guide/warehouses-gen2) or
[multi-cluster](/user-guide/warehouses-multicluster) warehouses at creation time

</dd>
</dl>

</blockquote>

## Optional parameters (`objectParams`)

<dl>
<dt><code className="samp">MAX_CONCURRENCY_LEVEL = <em>num</em></code></dt>
<dd>

Object parameter that specifies the concurrency level for SQL statements (that is, queries and DML) executed by a warehouse cluster.

For a detailed description of this parameter, see [](#label-max-concurrency-level).

</dd>
<dt><code className="samp">STATEMENT_QUEUED_TIMEOUT_IN_SECONDS = <em>num</em></code></dt>
<dd>

Object parameter that specifies the time, in seconds, a SQL statement (query, DDL, DML, and so on) can be queued on a warehouse before it is
canceled by the system.

For a detailed description of this parameter, see [](#label-statement-queued-timeout-in-seconds).

</dd>
<dt><code className="samp">STATEMENT_TIMEOUT_IN_SECONDS = <em>num</em></code></dt>
<dd>

Object parameter that specifies the time, in seconds, after which a running SQL statement (query, DDL, DML, and so on) is canceled by the system.

For a detailed description of this parameter, see [](#label-statement-timeout-in-seconds).

</dd>
</dl>

<a id="label-create-warehouse-access-control-requirements"></a>

## Access control requirements

A [role](#label-access-control-overview-roles) used to execute this operation must have the following
[privileges](#label-access-control-overview-privileges) at a minimum:

<div className="colwidths-auto">

  <thead>
    <tr>
      <th>Privilege</th>
      <th>Object</th>
      <th>Notes</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>CREATE WAREHOUSE</td>
      <td>Account</td>
      <td>%ac-sysadmin%</td>
    </tr>
    <tr>
      <td>OWNERSHIP</td>
      <td>Warehouse</td>
      <td>

Required to execute a [](#label-create-or-alter-warehouse-syntax) statement for an *existing* warehouse.

%ac-ownership%

</td>
    </tr>
  </tbody>

</div>

For instructions on creating a custom role with a specified set of privileges, see [](#label-security-custom-role).

For general information about roles and privilege grants for performing SQL actions on
[securable objects](#label-access-control-securable-objects), see [Overview of Access Control](/user-guide/security-access-control-overview).

## General usage notes

- Creating a virtual warehouse automatically sets it as the warehouse in use for the current session (equivalent to using the
  [](/sql-reference/sql/use-warehouse) command for the warehouse).

  To change the warehouse in use for the current session, execute an explicit USE WAREHOUSE statement after the
  CREATE WAREHOUSE statement. For example, create warehouse `my_wh` but continue to use the current warehouse, not `my_wh`,
  to execute additional statements:

  ```sql
  SET current_wh_name = (SELECT CURRENT_WAREHOUSE());

  CREATE OR REPLACE WAREHOUSE my_wh
    WAREHOUSE_SIZE = 'XSMALL';

  USE WAREHOUSE IDENTIFIER($current_wh_name);
  ```

- Regarding metadata:

  

  

Customers should ensure that no personal data (other than for a User object), sensitive data, export-controlled data, or other regulated data is entered as metadata when using the Snowflake service. For more information, see [Metadata fields in Snowflake](/sql-reference/metadata).

  

- Using `OR REPLACE` is the equivalent of using [](/sql-reference/sql/drop-warehouse) on the existing warehouse and then
  creating a new warehouse with the same name.

  

CREATE OR REPLACE *&lt;object&gt;* statements are atomic. That is, when an object is replaced, the old object is deleted and the new object is created in a single transaction.

  Any queries running on the dropped warehouse are aborted.

- The `OR REPLACE` and `IF NOT EXISTS` clauses are mutually exclusive. They can't both be used in the same statement.
- Initial creation and resumption of a Snowpark-optimized virtual warehouse may take longer than standard warehouses.

<a id="label-create-or-alter-warehouse-usage-notes"></a>

## CREATE OR ALTER WAREHOUSE usage notes

This feature is not available in the People's Republic of China.

**Limitations**

- All limitations of the [](/sql-reference/sql/alter-warehouse) command apply.
- The INITIALLY_SUSPENDED property can't be altered (SET or UNSET).

**Warehouse parameters and properties**

- The absence of a property or parameter that was previously set in the modified warehouse definition results in unsetting it.
- Unsetting an explicit parameter value results in setting it to the default parameter value.

**Data governance**

- Setting or unsetting a tag or policy on a warehouse using a CREATE OR ALTER WAREHOUSE statement is *not* supported.
- Existing policies or tags can't be altered by a CREATE OR ALTER WAREHOUSE statement and remain unchanged.

## Billing and pricing

For information on Snowpark-optimized warehouse credit consumption, see
`Table 1` in the [Snowflake Service Consumption Table](https://www.snowflake.com/legal-files/CreditConsumptionTable.pdf).

## Examples

### Basic examples

Create an X-Large warehouse:

<blockquote>

```sql
CREATE OR REPLACE WAREHOUSE my_wh WITH WAREHOUSE_SIZE = 'X-LARGE';
```

</blockquote>

Create a Large warehouse in a suspended state:

<blockquote>

```sql
CREATE OR REPLACE WAREHOUSE my_wh WAREHOUSE_SIZE = LARGE INITIALLY_SUSPENDED = TRUE;
```

</blockquote>

Create an X-Large Snowpark-optimized warehouse named `so_warehouse` with 256 GB memory for
Snowpark workloads that require x86 Python:

```sql
CREATE WAREHOUSE so_warehouse WITH
  WAREHOUSE_TYPE = 'SNOWPARK-OPTIMIZED'
  WAREHOUSE_SIZE = XLARGE
  RESOURCE_CONSTRAINT = 'MEMORY_16X_x86';
```

Create a Large generation 2 standard warehouse:

```sql
CREATE WAREHOUSE gen2_wh WITH
  WAREHOUSE_SIZE = LARGE
  GENERATION = '2';
```

<a id="label-create-or-alter-warehouse-examples"></a>

### CREATE OR ALTER WAREHOUSE examples

#### Create a simple warehouse

The following example shows how to use CREATE OR ALTER WAREHOUSE to create a Snowpark-optimized
warehouse, then modify its AUTO_RESUME setting.

```sql
CREATE OR ALTER WAREHOUSE so_warehouse
  WAREHOUSE_TYPE = 'SNOWPARK-OPTIMIZED'
  WAREHOUSE_SIZE = 'X-LARGE'
  RESOURCE_CONSTRAINT = 'MEMORY_16X_x86'
  AUTO_RESUME = TRUE
  COMMENT = 'Snowpark warehouse for ingestion';

CREATE OR ALTER WAREHOUSE so_warehouse
  WAREHOUSE_TYPE = 'SNOWPARK-OPTIMIZED'
  WAREHOUSE_SIZE = 'X-LARGE'
  RESOURCE_CONSTRAINT = 'MEMORY_16X_x86'
  AUTO_RESUME = FALSE
  COMMENT = 'Snowpark warehouse for ingestion (disabled for auto-resume)';
```

#### Create a Gen1 warehouse and alter it to Gen2

The following example demonstrates how CREATE OR ALTER WAREHOUSE works with the GENERATION
parameter, first creating a warehouse with generation 1 resources, then altering it to use
generation 2 resources.

```sql
-- Create a new warehouse with GENERATION = '1'
CREATE OR ALTER WAREHOUSE test_gen_warehouse
  WITH WAREHOUSE_SIZE = XSMALL
    GENERATION = '1'
    AUTO_SUSPEND = 60
    INITIALLY_SUSPENDED = TRUE;

-- Verify that it was created
SHOW WAREHOUSES LIKE 'test_gen_warehouse'
  ->> SELECT "name", "resource_constraint" FROM $1;

-- Alter it to GENERATION = '2'
CREATE OR ALTER WAREHOUSE test_gen_warehouse
  WITH WAREHOUSE_SIZE = SMALL
    GENERATION = '2'
    AUTO_SUSPEND = 120;

-- Verify that it was altered
SHOW WAREHOUSES LIKE 'test_gen_warehouse'
  ->> SELECT "name", "resource_constraint" FROM $1;

-- Clean up when done
DROP WAREHOUSE test_gen_warehouse;
```