📖 Scenario: You are a cloud data engineer working with Snowflake. Your company wants to reduce costs while keeping data accessible and queries fast. You will create a simple Snowflake setup that shows how to optimize costs by managing warehouses and data retention.
🎯 Goal: Build a Snowflake configuration that creates a warehouse, sets an auto-suspend time to save costs, and configures data retention time for zero-copy cloning to optimize storage costs.
📋 What You'll Learn
Create a warehouse named cost_opt_warehouse with size SMALL
Set the warehouse to auto-suspend after 300 seconds of inactivity
Set the data retention time for the database cost_opt_db to 1 day
Use zero-copy cloning to create a clone of a table named sales_data in cost_opt_db
💡 Why This Matters
🌍 Real World
Companies use these strategies to reduce cloud data warehouse costs while maintaining performance and data availability.
💼 Career
Cloud data engineers and architects must optimize Snowflake resources to control budgets and improve efficiency.
Progress0 / 4 steps
1
Create the warehouse
Create a warehouse named cost_opt_warehouse with size SMALL.
Snowflake
Hint
Use the CREATE WAREHOUSE command with WAREHOUSE_SIZE option.
2
Set auto-suspend time
Alter the warehouse cost_opt_warehouse to auto-suspend after 300 seconds of inactivity.
Snowflake
Hint
Use ALTER WAREHOUSE with SET AUTO_SUSPEND = 300.
3
Set data retention time
Create a database named cost_opt_db and set its data retention time to 1 day.
Snowflake
Hint
Use CREATE DATABASE with DATA_RETENTION_TIME_IN_DAYS = 1.
4
Create a zero-copy clone
Create a zero-copy clone of the table sales_data from cost_opt_db named sales_data_clone in the same database.
Snowflake
Hint
Use CREATE TABLE ... CLONE ... syntax for zero-copy cloning.
Practice
(1/5)
1. Which Snowflake feature helps reduce costs by automatically stopping a warehouse when it's not in use?
easy
A. Auto-suspend
B. Multi-cluster warehouse
C. Data sharing
D. Continuous data protection
Solution
Step 1: Understand warehouse billing
Snowflake charges for compute resources while warehouses run, even if idle.
Step 2: Identify cost-saving feature
Auto-suspend stops the warehouse after inactivity, preventing unnecessary charges.
Final Answer:
Auto-suspend -> Option A
Quick Check:
Auto-suspend = stops warehouse when idle [OK]
Hint: Auto-suspend pauses compute to save money when idle [OK]
Common Mistakes:
Confusing auto-suspend with auto-resume
Thinking multi-cluster reduces cost automatically
Assuming data sharing affects compute cost
2. Which of the following is the correct syntax to set a warehouse to auto-suspend after 5 minutes in Snowflake?
easy
A. ALTER WAREHOUSE my_wh SET AUTO_SUSPEND = '5 minutes';
B. ALTER WAREHOUSE my_wh SET AUTO_SUSPEND = 5;
C. ALTER WAREHOUSE my_wh SET AUTO_SUSPEND = 300;
D. ALTER WAREHOUSE my_wh SET AUTO_SUSPEND = TRUE;
Solution
Step 1: Understand AUTO_SUSPEND unit
Snowflake expects AUTO_SUSPEND value in seconds, so 5 minutes = 300 seconds.
Step 2: Check syntax correctness
ALTER WAREHOUSE my_wh SET AUTO_SUSPEND = 300; uses correct syntax and value (300 seconds). Others use wrong units or types.
Final Answer:
ALTER WAREHOUSE my_wh SET AUTO_SUSPEND = 300; -> Option C
Quick Check:
Auto-suspend time in seconds = 300 [OK]
Hint: Auto-suspend time is in seconds, not minutes [OK]
Common Mistakes:
Using minutes instead of seconds
Setting AUTO_SUSPEND to TRUE/FALSE
Using string values instead of integers
3. Consider this Snowflake SQL snippet:
ALTER WAREHOUSE wh1 SET AUTO_SUSPEND = 600;
ALTER WAREHOUSE wh1 SET AUTO_RESUME = TRUE;
What is the effect on cost when no queries run for 15 minutes?
medium
A. Warehouse suspends after 10 minutes, no charges after that
B. Warehouse keeps running, charges continue for 15 minutes
C. Warehouse suspends immediately, no charges after query ends
D. Warehouse suspends after 15 minutes, charges continue until then
Solution
Step 1: Analyze AUTO_SUSPEND setting
Warehouse suspends after 600 seconds (10 minutes) of inactivity.
Step 2: Understand AUTO_RESUME behavior
Warehouse auto-resumes on new queries, but here no queries run for 15 minutes.
Step 3: Calculate cost impact
Charges stop after suspension at 10 minutes; no charges for last 5 minutes idle.
Final Answer:
Warehouse suspends after 10 minutes, no charges after that -> Option A
Quick Check:
Auto-suspend 600s stops charges after 10 min idle [OK]
Hint: Auto-suspend time controls idle billing stop [OK]
Common Mistakes:
Assuming warehouse suspends immediately after last query
Thinking charges continue for full 15 minutes
Confusing auto-resume with auto-suspend timing
4. You set a warehouse with AUTO_SUSPEND = 0 and AUTO_RESUME = TRUE. What issue might this cause?
medium
A. Warehouse auto-resume is disabled, queries fail
B. Warehouse never suspends, causing continuous charges
C. Warehouse suspends after default 10 minutes ignoring 0
D. Warehouse suspends immediately, causing query failures
Solution
Step 1: Understand AUTO_SUSPEND = 0 meaning
Setting AUTO_SUSPEND to 0 disables suspension; warehouse runs continuously.
Step 2: Check AUTO_RESUME effect
AUTO_RESUME TRUE allows auto start but does not suspend warehouse automatically.
Step 3: Identify cost impact
Warehouse never suspends, so charges accrue continuously even if idle.
Final Answer:
Warehouse never suspends, causing continuous charges -> Option B
Quick Check:
AUTO_SUSPEND=0 means no suspend, costs continue [OK]
5. A company wants to minimize Snowflake costs by scheduling warehouse usage only during business hours (9am-5pm). Which combination of strategies best achieves this?
hard
A. Set warehouse to always on and rely on auto-resume to start queries
B. Use multi-cluster warehouse to handle peak loads during business hours
C. Disable auto-suspend and manually suspend warehouse after hours
D. Use auto-suspend with 1-minute timeout and schedule warehouse start/stop tasks at 9am and 5pm
Solution
Step 1: Understand scheduling needs
Warehouse should run only during business hours to save costs outside those times.
Step 2: Evaluate options
Use auto-suspend with 1-minute timeout and schedule warehouse start/stop tasks at 9am and 5pm combines auto-suspend (quick suspend) and scheduled start/stop tasks to control usage precisely.
Step 3: Rule out other options
Set warehouse to always on and rely on auto-resume to start queries wastes cost by always on; C is manual and error-prone; D increases cost for peak handling.
Final Answer:
Use auto-suspend with 1-minute timeout and schedule warehouse start/stop tasks at 9am and 5pm -> Option D
Quick Check:
Scheduled start/stop + auto-suspend = cost control [OK]
Hint: Schedule start/stop plus auto-suspend for tight cost control [OK]
Common Mistakes:
Leaving warehouse always on wastes money
Relying on manual suspend risks forgetting
Using multi-cluster increases cost, not reduces
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.