Working with warehouses | Snowflake Documentation (2024)

All warehouse tasks can be performed from the Snowflake web interface or using the DDL commands for warehouses.

Creating a warehouse

A warehouse can be created through the web interface or using SQL:

Snowsight:

Select Admin » Warehouses » Warehouse

Classic Console:

Select Warehouses » Create

SQL:

Execute a CREATE WAREHOUSE command.

When you create a warehouse, you can specify whether the warehouse is created initially in the “Started” (i.e. running) or “Suspended”state. If you choose “Started”, the warehouse starts consuming credits once all the compute resources are provisioned for the warehouse.

Note

If you choose to create a warehouse in the “Started” state, the warehouse may take some time to become fully available as Snowflakeprovisions all the compute resources for the warehouse.

Starting or resuming a warehouse

A warehouse can be started at any time, including on initial creation. Once a warehouse is created, resuming a warehouse is the same asstarting a warehouse.

A suspended (i.e. inactive) warehouse can be resumed through the web interface or using SQL:

Snowsight:

Select Admin » Warehouses » <suspended_warehouse_name> » » Resume

Classic Console:

Select Warehouses » <suspended_warehouse_name> » Resume

SQL:

Execute an ALTER WAREHOUSE command with the RESUME keyword.

Starting a warehouse typically takes only a few seconds; however, in some rare instances, it can take longer as Snowflake provisions thecompute resources for the warehouse.

Warehouses consume credits while running:

  • A warehouse begins to consume credits once all the compute resources are provisioned for the warehouse.

    • In a rare instance when some of the compute resources fail to provision, the warehouse only consumes credits for the provisionedcompute resources.

    • Once the remaining compute resources are successfully provisioned, the warehouse starts consuming credits for all requested computeresources.

  • While starting or resuming a warehouse often takes only a few seconds, in some instances, it can take longer as Snowflake provisions thecompute resources for the warehouse.

  • Snowflake does not begin executing SQL statements submitted to a warehouse until all of the compute resources for the warehouse aresuccessfully provisioned, unless any of the resources fail to provision:

    • If any of the compute resources for the warehouse fail to provision during start-up, Snowflake attempts to repair the failed resources.

    • During the repair process, the warehouse starts processing SQL statements once 50% or more of the requested compute resources aresuccessfully provisioned.

Credits are billed on a per-second basis while the warehouse is running, with a 1-minute minimum each time the warehouse is resumed; however,credit consumption is reported in 60-minute (i.e. hourly) increments.

Note

A warehouse must be running and the current warehouse for the session (i.e. in use) toprocess SQL statements submitted in the session. For more information, refer to Using a Warehouse in this topic.

Suspending a warehouse

A running warehouse can be suspended at any time, even while executing SQL statements. Suspending a warehouse stops thewarehouse from consuming credits once all the compute resources shut down.

A warehouse can be suspended through the web interface or using SQL:

Snowsight:

Select Admin » Warehouses » <started_warehouse_name> » » Suspend

Classic Console:

Select Warehouses » <started_warehouse_name> » Suspend

SQL:

Execute an ALTER WAREHOUSE command with the SUSPEND keyword.

When you suspend a warehouse, Snowflake immediately shuts down all idle compute resources for the warehouse, but allows any computeresources that are executing statements to continue until the statements complete, at which time the resources are shut down and the statusof the warehouse changes to “Suspended”. Compute resources waiting to shut down are considered to be in “quiesce” mode.

Resizing a warehouse

A warehouse can be resized up or down at any time, including while it is running and processing statements.

A warehouse can be resized through the web interface or using SQL:

Snowsight:

Select Admin » Warehouses » <warehouse_name> » » Edit

Classic Console:

Select Warehouses » <warehouse_name> » Configure

SQL:

Execute an ALTER WAREHOUSE command with SET WAREHOUSE_SIZE = ....

Resizing a warehouse to a larger size is useful when the operations being performed by the warehouse will benefit from more compute resources,including:

  • Improving the performance of large, complex queries against large data sets.

  • Improving performance while loading and unloading significant amounts of data.

Effects of resizing a running warehouse

Resizing a running warehouse adds or removes compute resources in each cluster in the warehouse. All the usage and creditrules associated with starting or suspending a warehouse apply to resizing a started warehouse, such as:

  • Compute resources added to a warehouse start using credits when they are provisioned; however, the additional compute resources don’tstart executing statements until they are all provisioned, unless some of the resources fail to provision.

  • Compute resources are removed from a warehouse only when they are no longer being used to execute any current statements.

Resizing a warehouse doesn’t have any impact on statements that are currently being executed by the warehouse. When resizing to a largersize, the new compute resources, once fully provisioned, are used only to execute statements that are already in the warehouse queue, aswell as all future statements submitted to the warehouse.

Tip

To verify the additional compute resources for your warehouse have been fully provisioned, add the WAIT_FOR_COMPLETION parameterto the ALTER WAREHOUSE command. You can also use SHOW WAREHOUSES to check itsstate.

Effects of resizing a suspended warehouse

Resizing a suspended warehouse does not provision any new compute resources for the warehouse. It simply instructs Snowflake to provisionthe additional compute resources when the warehouse is next resumed, at which time all the usage and credit rules associated with starting awarehouse apply.

Using a warehouse

To execute a query or DML statement in Snowflake, a warehouse must be running and it must be specified as the current warehouse for thesession in which the query/statement is submitted.

A Snowflake session can only have one current warehouse at a time. The current warehouse for the session can be specified or changed at anytime through the USE WAREHOUSE command.

Once a running warehouse has been set as the current warehouse for the session, queries and DML statements submitted within the session areprocessed by the warehouse. In the History and Worksheets pages in the Classic Console,you can view the warehouse used to process each query/statement.

Delegating warehouse management

By default, the ACCOUNTADMIN role is granted the ability to alter, suspend, describe, and perform other operations on allwarehouses in the account.

If you need to delegate these abilities to a custom role in your account, you can use theGRANT <privileges> command to grant the MANAGE WAREHOUSES privilege to that role. Granting the MANAGEWAREHOUSES privilege is equivalent to granting the MODIFY, MONITOR, and OPERATE privileges on all warehouses in the account.

The following examples demonstrate how you can delegate the ability to manage warehouses to a custom role namedmanage_wh_role. The example uses the manage_wh_role to make changes to the warehouse test_wh, which is owned by adifferent role (create_wh_role).

Create a new role that will create and own a new warehouse, and grant the CREATE WAREHOUSE privilege to that role:

CREATE ROLE create_wh_role;GRANT CREATE WAREHOUSE ON ACCOUNT TO ROLE create_wh_role;GRANT ROLE create_wh_role TO ROLE SYSADMIN;

Copy

Create a second role that will manage all warehouses in the account, and grant the MANAGE WAREHOUSES privilege to that role:

CREATE ROLE manage_wh_role;GRANT MANAGE WAREHOUSES ON ACCOUNT TO ROLE manage_whs_role;GRANT ROLE manage_whs_role TO ROLE SYSADMIN;

Copy

Using the create_wh_role role, create a new warehouse:

USE ROLE create_wh_role;CREATE OR REPLACE WAREHOUSE test_wh WITH WAREHOUSE_SIZE= XSMALL;

Copy

Change the current role to manage_wh_role:

USE ROLE manage_whs_role;

Copy

Although the manage_wh_role does not own the test_wh, that role does have the MANAGE WAREHOUSES privilege, which meansthat you can:

  • Suspend and resume the warehouse:

    ALTER WAREHOUSE test_wh SUSPEND;ALTER WAREHOUSE test_wh RESUME;

    Copy

  • Change the size of the warehouse:

    ALTER WAREHOUSE test_wh SET WAREHOUSE_SIZE = SMALL;

    Copy

  • Describe the warehouse:

    DESC WAREHOUSE test_wh;

    Copy

Review Warehouse Details in Snowsight

You must use the ACCOUNTADMIN role, or a role granted the relevant warehouse privileges.

To review warehouses and manage warehouse details in Snowsight, complete the following steps:

  1. Sign in to Snowsight.

  2. Select Admin » Warehouses.

You can then review the table of warehouses, search for warehouses, or filter the list of warehouses by status or size.

By default, you can see the following information about each warehouse:

  • Name

  • Status, such as Started, Resuming, or Suspended.

  • Size

  • Clusters, indicated by a bar in the column. You can hover over the value to see how many clusters are active.

  • Running, for details on how many SQL statements are being executed by the warehouse.

  • Queued, for details on how many SQL statements are queued for the warehouse.

  • Owner, or the owning role for the warehouse.

  • Resumed, to see how long ago the warehouse was resumed. Hover over the value to see the exact date and timestamp in your local time zone.

You can also add columns to see additional details for each warehouse in the table:

  • QAS (Scale Factor), to see the scale factor of the warehouse used by Query Acceleration Service (QAS).See Using the Query Acceleration Service.

  • Scaling Policy, to see the scaling policy defined for the warehouse. See Setting the scaling policy for a multi-cluster warehouse.

  • Auto Resume, to see whether auto-resume is set up for the warehouse.

  • Auto Suspend, to see the time period before auto-suspend occurs for the warehouse.

  • Created, to see when the warehouse was created. Hover over the value to see the exact date and timestamp in your local time zone.

When you select a warehouse in the Warehouses table, you can see more details:

  • The Warehouse Activity section provides a graph of warehouse load over a period of time, which can help you understand why aquery might be running slowly. See Monitoring warehouse load for more details.

  • The Details section provides additional information about your warehouse, including:

    • The status of the warehouse.

    • The size of the warehouse.

    • Maximum and minimum number of clusters the warehouse can use.

    • The scaling policy.

    • The number of tasks that are running and queued.

    • The period of no activity before the warehouse is automatically suspended.

    • If the warehouse is suspended, whether to automatically resume the warehouse when needed.

    • The last time the warehouse resumed operation.

  • You can use the Privileges section to view, grant, and revoke privileges on the warehouse.

Working with warehouses | Snowflake Documentation (2024)
Top Articles
5 Unusual Ways To Accelerate Your Financial Independence
Cipher.exe Security Tool for the Encrypting File System
English Bulldog Puppies For Sale Under 1000 In Florida
Katie Pavlich Bikini Photos
Gamevault Agent
Pieology Nutrition Calculator Mobile
Hocus Pocus Showtimes Near Harkins Theatres Yuma Palms 14
Hendersonville (Tennessee) – Travel guide at Wikivoyage
Compare the Samsung Galaxy S24 - 256GB - Cobalt Violet vs Apple iPhone 16 Pro - 128GB - Desert Titanium | AT&T
Vardis Olive Garden (Georgioupolis, Kreta) ✈️ inkl. Flug buchen
Craigslist Dog Kennels For Sale
Things To Do In Atlanta Tomorrow Night
Non Sequitur
Crossword Nexus Solver
How To Cut Eelgrass Grounded
Pac Man Deviantart
Alexander Funeral Home Gallatin Obituaries
Energy Healing Conference Utah
Geometry Review Quiz 5 Answer Key
Hobby Stores Near Me Now
Icivics The Electoral Process Answer Key
Allybearloves
Bible Gateway passage: Revelation 3 - New Living Translation
Yisd Home Access Center
Pearson Correlation Coefficient
Home
Shadbase Get Out Of Jail
Gina Wilson Angle Addition Postulate
Celina Powell Lil Meech Video: A Controversial Encounter Shakes Social Media - Video Reddit Trend
Walmart Pharmacy Near Me Open
Marquette Gas Prices
A Christmas Horse - Alison Senxation
Ou Football Brainiacs
Access a Shared Resource | Computing for Arts + Sciences
Vera Bradley Factory Outlet Sunbury Products
Pixel Combat Unblocked
Movies - EPIC Theatres
Cvs Sport Physicals
Mercedes W204 Belt Diagram
Mia Malkova Bio, Net Worth, Age & More - Magzica
'Conan Exiles' 3.0 Guide: How To Unlock Spells And Sorcery
Teenbeautyfitness
Where Can I Cash A Huntington National Bank Check
Topos De Bolos Engraçados
Sand Castle Parents Guide
Gregory (Five Nights at Freddy's)
Grand Valley State University Library Hours
Hello – Cornerstone Chapel
Stoughton Commuter Rail Schedule
Nfsd Web Portal
Selly Medaline
Latest Posts
Article information

Author: Terence Hammes MD

Last Updated:

Views: 6245

Rating: 4.9 / 5 (49 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Terence Hammes MD

Birthday: 1992-04-11

Address: Suite 408 9446 Mercy Mews, West Roxie, CT 04904

Phone: +50312511349175

Job: Product Consulting Liaison

Hobby: Jogging, Motor sports, Nordic skating, Jigsaw puzzles, Bird watching, Nordic skating, Sculpting

Introduction: My name is Terence Hammes MD, I am a inexpensive, energetic, jolly, faithful, cheerful, proud, rich person who loves writing and wants to share my knowledge and understanding with you.