Module 15 · Lesson 13 of 14Detailed study · about 30 min

Sizing, concurrency and workload investigation

Warehouse tuning separates the resources needed by one query from the capacity needed by many queries arriving together.

Your learning goal

Use timing phases and workload history to choose SQL optimization, scale-up, scale-out or workload isolation.

Understand the idea

A concrete example

If a query is slow when run alone and spills heavily, additional memory or less intermediate data may help. If it executes quickly alone but waits during dashboard rush hour, investigate concurrency and scheduling.

Key ideas in simple English
ConceptWhat it means
Scale upIncrease resources in a warehouse cluster.
Scale outUse additional clusters to serve concurrent work.
QueueingWait because available execution resources are busy or being provisioned.
Workload isolationGive workloads separate compute resources.

Remember: Match the remedy to the measured bottleneck. Compare query-level behavior and workload-level delivery before accepting extra ongoing capacity.

Explain it step by step · full theory

Learning goals and prerequisites

Use timing phases and workload history to choose SQL optimization, scale-up, scale-out or workload isolation.

Use the M15_LAB setup from lesson 1. Know SELECT, joins, aggregates and window functions from Modules 03–04. Follow the supplied examples with an authorized warehouse and an isolated learning role. Keep the same data and account context when comparing runs.

One slow query is not the same as a busy queue

If a query is slow when run alone and spills heavily, additional memory or less intermediate data may help. If it executes quickly alone but waits during dashboard rush hour, investigate concurrency and scheduling.

More clusters generally distribute concurrent requests; they do not combine into one giant cluster for a single ordinary query. A larger cluster may improve one query, but the plan must be able to use its resources.

Measure before changing capacity

Capture warehouse size, type/generation, cache conditions and concurrent load. Compare compilation, overload queueing, provisioning queueing and execution. A warehouse-resume delay is not the same cause as an overloaded active warehouse.

A single warehouse for ad hoc exploration and a critical dashboard can create unpredictable contention. Separate authorized workloads or stagger batch jobs where that meets the business requirement before paying for persistent extra capacity.

Use account-level context

Query History connects exact SQL and query IDs to timing. Performance Explorer helps compare workload trends, warehouse/table changes and problem periods. Start with when behavior changed, then drill down to specific queries and profiles.

Your role determines visible data. Account Usage views can lag; an empty view does not prove nothing ran. The session history function provides a narrower recent view, with its own time and result limits. Record monitoring scope when reporting findings.

Compare cost with delivery goals

A warehouse that runs twice as fast at twice the rate may have similar active compute consumption, but startup minima, idle time, concurrent work and service costs can change the outcome. Do not calculate a bill from query duration alone.

Multi-cluster warehouses require Enterprise Edition or higher. Use an approved upper cluster bound and scaling policy; additional active clusters consume credits. Learn the trade-off conceptually if administrative settings are unavailable.

Symptoms suggest different experiments

Symptoms suggest different experiments
Observed symptomFirst investigationAvoid assuming
High compilationGenerated SQL complexity and planningA larger warehouse fixes planning
High overload queueArrival bursts, query mix, workload isolationThe scan itself is inefficient
High provisioning queueResume/startup conditionsThe query needs clustering
Large necessary spillOperator input and an authorized size comparisonAll spilling comes from bad SQL
Repeated selective large scansPredicate and clustering/SOS evidenceEvery broad scan is a defect

Common mistakes and next action

Scale-out primarily addresses concurrent capacity. A single query needs plan and per-cluster resource analysis.

Match the remedy to the measured bottleneck. Compare query-level behavior and workload-level delivery before accepting extra ongoing capacity.

Words used in this lesson
Scale up
Increase resources in a warehouse cluster.
Scale out
Use additional clusters to serve concurrent work.
Queueing
Wait because available execution resources are busy or being provisioned.
Workload isolation
Give workloads separate compute resources.

See how it works

Choose a step to explore the idea at your own pace.

Open the interactive explanation
Interactive explainer1 / 4

Sizing, concurrency and workload investigation

Arrival burst
Busy resources
Queued requests

Observe

A dashboard can wait even when its own plan is efficient.

Automatic playback is off for reduced motion. Select any step or use Previous and Next. Illustrations explain behavior; they are not live measurements.

Read the complete diagram explanation
  1. Observe

    A dashboard can wait even when its own plan is efficient.

    Arrival burst → Busy resources → Queued requests

  2. Choose scale-up

    Compare more resources for a necessary expensive individual plan.

    One query → More memory/compute → Measure cost

  3. Choose scale-out

    Additional clusters can serve more concurrent requests.

    Many queries → More clusters → Bound consumption

  4. Validate workload

    Review latency distributions and load at comparable business periods.

    Same query mix → Queue + execution → Delivery target

Try the SQL or command

Read → predict → run in your learning environment → compare. You can also learn by reading without an account.

New to SQL? Where to run it and how to read it

A query is a question written in SQL. Snowflake runs it and returns a result table. This website shows examples; it does not connect to your account.

  1. No account yet? Read and predict the output first. Follow the account and Snowsight lesson when you are ready.
  2. For SQL practice, use a learning account in Snowsight and select an authorized role and warehouse. A role determines permissions; a warehouse supplies processing power. Follow the example’s database/schema setup when it refers to stored objects.
  3. Read the entire example, including comments beginning with --. Run the selected statement or labeled block in the stated order. Examples labeled Python, shell or HTTP belong in that client, not in a SQL editor.
  4. Compare values and row counts with the explained result. If an example deliberately causes an error, follow its rollback and cleanup steps before continuing.
SELECT / FROM
Choose the values to return / identify their input.
VALUES / COLUMN1
VALUES supplies tiny example rows. COLUMN1 means their first column, COLUMN2 their second.
AS / WITH
AS gives a result a readable name. WITH names a temporary query step within one statement.
NULL / ::
NULL means missing or unknown. The :: notation converts a value to a named data type.
Session
One connection and its settings. Keep related transaction steps in the same session.
Database.schema.table
A full address for stored data. It is separate from the warehouse that processes queries.

Need the L2_OBJECTS_LAB setup? Open the first database-object lesson →

Help with common practice errors
  • No active warehouse: select a warehouse your role can use. Do not assume you need to create a new one.
  • Object missing or not authorized: check the full name, required setup and active role. Ask the account owner for access if needed.
  • Object already exists: setup may already have run. Read the current state or choose a fresh lab name consistently; do not add OR REPLACE blindly.
  • Different result: check whether an earlier INSERT or UPDATE changed the data. VALUES examples provide their own fresh input for each statement.

Before running this lesson

Manual examples for L2_OBJECTS_LAB.M15_LAB. Select an authorized warehouse and a role with database/schema access and permission to create the lab objects. Setup runs once with fresh names. Optional paid services require their stated privileges and edition. SQL and performance timings have not been executed or measured for this lesson.

Investigate this session

SQL · example
SELECT QUERY_ID,QUERY_TAG,TOTAL_ELAPSED_TIME,COMPILATION_TIME,EXECUTION_TIME,
 QUEUED_OVERLOAD_TIME,QUEUED_PROVISIONING_TIME,BYTES_SCANNED,
 PARTITIONS_SCANNED,PARTITIONS_TOTAL,PERCENTAGE_SCANNED_FROM_CACHE,
 BYTES_SPILLED_TO_LOCAL_STORAGE,BYTES_SPILLED_TO_REMOTE_STORAGE
FROM TABLE(L2_OBJECTS_LAB.INFORMATION_SCHEMA.QUERY_HISTORY_BY_SESSION(RESULT_LIMIT=>1000))
WHERE QUERY_TAG LIKE 'learnsnowflake_m15%'
ORDER BY START_TIME DESC;

What to expect and why

Filter the exact report query IDs. PERCENTAGE_SCANNED_FROM_CACHE is a fraction from 0 to 1; multiply by 100 to display a percent.

Optional wider workload summary

SQL · example
-- Requires authorized access to Account Usage; data can lag.
SELECT WAREHOUSE_NAME,DATE_TRUNC('hour',START_TIME) AS HOUR,
 COUNT(*) AS QUERY_COUNT,AVG(EXECUTION_TIME) AS AVG_EXECUTION_MS,
 AVG(QUEUED_OVERLOAD_TIME) AS AVG_OVERLOAD_QUEUE_MS,
 MAX(QUEUED_PROVISIONING_TIME) AS MAX_PROVISIONING_MS
FROM SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY
WHERE START_TIME>=DATEADD('day',-1,CURRENT_TIMESTAMP())
 AND QUERY_TYPE='SELECT' AND WAREHOUSE_NAME IS NOT NULL
GROUP BY WAREHOUSE_NAME,DATE_TRUNC('hour',START_TIME)
ORDER BY HOUR,WAREHOUSE_NAME;

What to expect and why

This broad summary includes different SELECT workloads, so an average can hide outliers or changing query mix. Drill down by tag, query shape and exact IDs before drawing a conclusion.

Optional dedicated warehouse experiment template

SQL · example
-- Use an approved dedicated warehouse, never a shared production experiment.
-- SHOW WAREHOUSES LIKE 'M15_AUTHORIZED_WH';
-- Record original size, generation, cluster limits and scaling policy.
-- ALTER WAREHOUSE M15_AUTHORIZED_WH SET WAREHOUSE_SIZE='SMALL';
-- Rerun the same query, save its ID and inspect spill/execution.
-- Separate Enterprise+ concurrency experiment, after restoring the first change:
-- ALTER WAREHOUSE M15_AUTHORIZED_WH SET
--  MIN_CLUSTER_COUNT=1 MAX_CLUSTER_COUNT=2 SCALING_POLICY='STANDARD';
-- Restore ALL recorded original settings after each experiment.

What to expect and why

Warehouse MODIFY/control privileges are required. Compare one configuration change at a time. Do not leave additional capacity active after your approved investigation.

Check your understanding

Choose an answer, then check your reasoning. This is practice, not a scored test.

Will more warehouse clusters necessarily make one isolated query faster?

Try it yourself

Choose a first investigation for high compilation time, high overload queueing and high remote spill.

Compare your reasoning

Match the remedy to the measured bottleneck. Compare query-level behavior and workload-level delivery before accepting extra ongoing capacity.

Key takeaway

Match the remedy to the measured bottleneck. Compare query-level behavior and workload-level delivery before accepting extra ongoing capacity.

Connect this lesson to the learning path

Official sources and curriculum

Module 15 · See module scope

By Rohit Ray · Independent educational lesson · Explore this visual lab