page34
14
accounts can be used. You can find further information at
https://www.snowflake.com/
snowflake-essentials-training/
.
Otherwise, for those seasoned practitioners looking for inspiration, code samples,
and walk-throughs, there is no better suite of resources than those found at
https://
quickstarts.snowflake.com/
.
Ignore tuning your design at your peril; this step is the lowest cost while providing
the biggest “bang per buck” regardless of platform. This advice will serve you well
throughout your IT career.
Your First Optimization
You declare compute in T-shirt-sized warehouses according to the perceived demand
your SQL statement will place upon CSP resources.
Every time you execute a SQL statement requiring a warehouse, you incur cost.
By default, Snowflake delivers a single warehouse called
compute_wh
, and your first
optimization must be to ensure the default warehouse. Every other defined warehouse
runs for the minimum time before suspending. The default setting for auto-suspending
compute_wh
is 10 minutes, or 600 seconds.
We use the
auto_suspend
attribute with a minimum of 60 seconds as shown next:
SHOW warehouses;
ALTER WAREHOUSE compute_wh SET auto_suspend = 60;
Every warehouse regardless of size runs for a minimum of 60 seconds, with per
second billing thereafter.
Warehouse events tell us information relating to warehouses; we use this
information primarily to check the
RESUME
and
SUSPEND
conditions where the next SQL
statement can be used.
SELECT *
FROM snowflake.account_usage.warehouse_events_history
WHERE warehouse_name = 'COMPUTE_WH'
ORDER BY timestamp DESC;
Figure 1-2 shows sample output.
ChaptEr 1
tuning thE SnowFlakE Data ClouD