How to Set Auto Suspend Warehouse in Snowflake
To set auto suspend for a Snowflake warehouse, use the
ALTER WAREHOUSE command with the AUTO_SUSPEND parameter specifying the idle time in seconds. This setting automatically suspends the warehouse after the specified idle period to save costs.Syntax
The syntax to set auto suspend on a Snowflake warehouse is:
ALTER WAREHOUSE <warehouse_name> SET AUTO_SUSPEND = <seconds>;<warehouse_name>is the name of your warehouse.<seconds>is the idle time in seconds before the warehouse suspends automatically.
sql
ALTER WAREHOUSE my_warehouse SET AUTO_SUSPEND = 300;
Example
This example sets the auto suspend time to 5 minutes (300 seconds) for a warehouse named my_warehouse. After 5 minutes of inactivity, the warehouse will suspend automatically.
sql
ALTER WAREHOUSE my_warehouse SET AUTO_SUSPEND = 300;
Output
Statement executed successfully.
Common Pitfalls
Common mistakes when setting auto suspend include:
- Setting
AUTO_SUSPENDto 0 disables auto suspend, which can lead to unnecessary costs. - Not granting the required privileges to alter the warehouse.
- Confusing
AUTO_SUSPENDwithAUTO_RESUME, which controls automatic resume behavior.
sql
/* Wrong: disables auto suspend (keeps warehouse always running) */ ALTER WAREHOUSE my_warehouse SET AUTO_SUSPEND = 0; /* Right: sets auto suspend to 10 minutes */ ALTER WAREHOUSE my_warehouse SET AUTO_SUSPEND = 600;
Quick Reference
| Parameter | Description | Example Value |
|---|---|---|
| AUTO_SUSPEND | Idle time in seconds before warehouse suspends | 300 |
| AUTO_RESUME | Enable automatic resume when queries start | TRUE |
| WAREHOUSE_NAME | Name of the warehouse to configure | my_warehouse |
Key Takeaways
Use ALTER WAREHOUSE with AUTO_SUSPEND to set idle time before suspension.
Set AUTO_SUSPEND to a positive number of seconds; 0 disables auto suspend.
Ensure you have the right privileges to alter the warehouse.
Auto suspend helps save costs by suspending idle warehouses automatically.
