Bird
Raised Fist0
Snowflakecloud~10 mins

Cost optimization strategies in Snowflake - Step-by-Step Execution

Choose your learning style10 modes available
Process Flow - Cost optimization strategies
Identify Cost Drivers
↓
Analyze Usage Patterns
↓
Apply Optimization Techniques
↓
Monitor & Adjust
↓
Repeat Cycle for Continuous Savings
This flow shows how to find what costs the most, analyze usage, apply ways to save money, then watch and adjust continuously.
Execution Sample
Snowflake
CREATE WAREHOUSE mywh WITH WAREHOUSE_SIZE = 'SMALL';
ALTER WAREHOUSE mywh SET AUTO_SUSPEND = 60;
ALTER WAREHOUSE mywh SET AUTO_RESUME = TRUE;
This code creates a small compute warehouse and sets it to suspend after 60 seconds of inactivity and resume automatically to save costs.
Process Table
StepActionParameter/ValueEffect on CostResult
1Create warehouseSize = SMALLLower compute costWarehouse 'mywh' created with small size
2Set auto suspendAUTO_SUSPEND = 60 secondsStops warehouse when idleWarehouse suspends after 60s inactivity
3Set auto resumeAUTO_RESUME = TRUEResumes warehouse on demandWarehouse resumes automatically on query
4Query runsWarehouse resumesCost incurred only during usageWarehouse active during query execution
5Idle period60 seconds passedWarehouse suspendsNo cost during idle time
6Repeat usageWarehouse resumes againCost only when neededCost optimized by suspending when idle
💡 Warehouse suspends after 60 seconds idle, minimizing cost when not in use
Status Tracker
VariableStartAfter Step 1After Step 2After Step 3After Step 5Final
Warehouse SizeN/ASMALLSMALLSMALLSMALLSMALL
Warehouse StateNot createdSuspendedSuspendedSuspendedSuspendedSuspended
Auto SuspendN/AEnabled (60s)Enabled (60s)Enabled (60s)Enabled (60s)Enabled (60s)
Auto ResumeN/AEnabledEnabledEnabledEnabledEnabled
Key Moments - 3 Insights
Why does setting AUTO_SUSPEND help reduce costs?
Because it stops the warehouse when not in use, so you don't pay for idle compute time. See execution_table step 2 and 5.
What happens if AUTO_RESUME is not enabled?
You would have to manually start the warehouse before queries run, which can cause delays and extra manual work. See execution_table step 3.
Does choosing a SMALL warehouse size always save money?
It saves money for light workloads but may slow queries if too small. Balance size with performance needs. See execution_table step 1.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, at which step does the warehouse suspend after inactivity?
AStep 2
BStep 4
CStep 5
DStep 6
💡 Hint
Check the 'Effect on Cost' column for when the warehouse stops to save cost.
According to variable_tracker, what is the warehouse state after step 5?
ARunning
BSuspended
CNot created
DStarting
💡 Hint
Look at the 'Warehouse State' row under 'After Step 5' column.
If AUTO_RESUME was set to FALSE, what would change in the execution flow?
AWarehouse would not resume automatically on query
BWarehouse would suspend automatically
CWarehouse size would increase
DWarehouse would never suspend
💡 Hint
Refer to execution_table step 3 and key_moments about AUTO_RESUME.
Concept Snapshot
Cost Optimization in Snowflake:
- Use SMALL warehouse size for light workloads
- Enable AUTO_SUSPEND to stop compute when idle
- Enable AUTO_RESUME to start compute on demand
- Monitor usage and adjust settings regularly
- Balance cost savings with performance needs
Full Transcript
This lesson shows how to save money using Snowflake by creating a small compute warehouse, setting it to suspend automatically after 60 seconds of inactivity, and enabling it to resume automatically when queries run. The warehouse only runs when needed, reducing idle compute costs. Variables like warehouse size and state change as the warehouse is created, suspended, and resumed. Key points include why auto suspend saves cost, the importance of auto resume, and balancing warehouse size with workload. The visual quiz tests understanding of when suspension happens, warehouse state changes, and effects of disabling auto resume.

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

  1. Step 1: Understand warehouse billing

    Snowflake charges for compute resources while warehouses run, even if idle.
  2. Step 2: Identify cost-saving feature

    Auto-suspend stops the warehouse after inactivity, preventing unnecessary charges.
  3. Final Answer:

    Auto-suspend -> Option A
  4. 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

  1. Step 1: Understand AUTO_SUSPEND unit

    Snowflake expects AUTO_SUSPEND value in seconds, so 5 minutes = 300 seconds.
  2. 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.
  3. Final Answer:

    ALTER WAREHOUSE my_wh SET AUTO_SUSPEND = 300; -> Option C
  4. 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

  1. Step 1: Analyze AUTO_SUSPEND setting

    Warehouse suspends after 600 seconds (10 minutes) of inactivity.
  2. Step 2: Understand AUTO_RESUME behavior

    Warehouse auto-resumes on new queries, but here no queries run for 15 minutes.
  3. Step 3: Calculate cost impact

    Charges stop after suspension at 10 minutes; no charges for last 5 minutes idle.
  4. Final Answer:

    Warehouse suspends after 10 minutes, no charges after that -> Option A
  5. 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

  1. Step 1: Understand AUTO_SUSPEND = 0 meaning

    Setting AUTO_SUSPEND to 0 disables suspension; warehouse runs continuously.
  2. Step 2: Check AUTO_RESUME effect

    AUTO_RESUME TRUE allows auto start but does not suspend warehouse automatically.
  3. Step 3: Identify cost impact

    Warehouse never suspends, so charges accrue continuously even if idle.
  4. Final Answer:

    Warehouse never suspends, causing continuous charges -> Option B
  5. Quick Check:

    AUTO_SUSPEND=0 means no suspend, costs continue [OK]
Hint: AUTO_SUSPEND=0 disables suspend, causing constant charges [OK]
Common Mistakes:
  • Thinking 0 means immediate suspend
  • Assuming AUTO_RESUME disables charges
  • Believing default suspend time applies
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

  1. Step 1: Understand scheduling needs

    Warehouse should run only during business hours to save costs outside those times.
  2. 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.
  3. 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.
  4. Final Answer:

    Use auto-suspend with 1-minute timeout and schedule warehouse start/stop tasks at 9am and 5pm -> Option D
  5. 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 unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard