CertSafari
    Snowflake SnowPro Advanced: Architect (ARA-C01)· Lessons

    Domain 4 · Lesson 12/13

    Query Profile, warehouse sizing, scaling and caching in Snowflake

    Outline performance tools, best practices, and appropriate scenarios where they should be applied.

    20 min read
    10% of exam
    14 sources
    Published 20 Oct 2026
    Docs as of 18 Oct 2026

    What you will be able to do

    • Read a Query Profile and query history to find the operator or wait that dominates a slow query, then match it to a fix
    • Choose between scaling a warehouse up, scaling it out with multi-cluster, and enabling query acceleration, from the symptom shown
    • Decide when a Snowpark-optimized warehouse is worth using
    • Set auto-suspend for a workload while accounting for the result, warehouse and metadata cache layers
    • Judge from clustering metadata whether auto-clustering is keeping a clustered table well ordered
    • Tell local spill from remote spill in the profile and history, and recommend the matching fix
    • Predict whether a repeated query will be served from the result cache

    Key concept

    Bottleneck-driven tuning — Every Snowflake performance tool fixes one particular kind of cost. Use the Query Profile and query history to find where the time actually goes (a scan, a join, spilling, or waiting in a queue), then pick the tool that fixes that cost. Never pick the tool first.

    1.Reading the Query Profile and query history

    Performance work in Snowflake starts with evidence. The tools for making a query faster each cost credits, and each one helps only one kind of problem. Picking one before you know where the time goes is the most expensive way to tune. There are two places to look. Query history shows which queries are slow, and the Query Profile shows why a particular one is slow.

    In Snowsight, Monitoring » Query History lists queries with a Duration column you can sort, and filters by user or warehouse. Select a query ID and open the Query Profile tab to see the operator tree. Its Most Expensive Nodes pane ranks the operators that take the longest, and you can drill into each node to see how much of its time went to each category of processing. To get the same statistics in SQL, use the GET_QUERY_OPERATOR_STATS function.

    For history across many queries, use the ACCOUNT_USAGE views. QUERY_HISTORY keeps 365 days and can lag by up to 45 minutes. WAREHOUSE_LOAD_HISTORY can lag by up to 3 hours. By default only ACCOUNTADMIN can read these views. Users without access can call the Information Schema QUERY_HISTORY table functions instead, which also update sooner. If you need to inspect a query you just ran, use Snowsight. In QUERY_HISTORY, the query_hash column groups repeated runs of the same query. A query that is cheap per run but runs thousands of times can cost more in total than one slow outlier.

    The time breakdown in the profile tells you what to fix. Three patterns come up again and again.

    • A TableScan dominates and few partitions are pruned. The query reads far more micro-partitions than its filter needs. Compare partitions scanned with partitions total, which QUERY_HISTORY also records. When the two are close, the filter is not pruning (see Micro-partition pruning). The fix is on the storage side, such as a clustering key on the filtered column. A bigger warehouse just reads the same unnecessary partitions faster.
    • A Join dominates while the scans feeding it are cheap. Work on the join itself, meaning its keys and how selective they are. Adding a clustering key to the scanned tables targets the 5% of the time spent scanning, not the 70% spent joining. Raising a timeout only gives the same bad join more time to run.
    • A Join outputs far more rows than its inputs combined. This is an exploding join. Either the join has no condition (a Cartesian product), or a key that should be unique on one side is duplicated, so every match multiplies rows. Check the side that should be unique, such as duplicate order_id values in ORDERS, before changing anything else.

    A related mistake shows up as a UnionAll operator with an extra Aggregate on top. That pattern means UNION was used where UNION ALL would do, and the aggregate is paying for duplicate elimination nobody needed. UNION ALL simply concatenates two inputs. It does not match rows on a key, so it cannot replace a join that fans out.

    Warehouses that had queued load over the past month, from WAREHOUSE_LOAD_HISTORYsql
    SELECT TO_DATE(start_time) AS date,
      warehouse_name,
      SUM(avg_running) AS sum_running,
      SUM(avg_queued_load) AS sum_queued
    FROM snowflake.account_usage.warehouse_load_history
    WHERE TO_DATE(start_time) >= DATEADD(month,-1,CURRENT_TIMESTAMP())
    GROUP BY 1,2
    HAVING SUM(avg_queued_load) >0;

    Auto-clustering keeps a clustered table's micro-partitions ordered as data changes, and its health shows up in pruning. DML on a clustered table gradually degrades the order. Snowflake reclusters in the background with no maintenance from you, but only when the table will benefit. So when a clustered table still scans too many partitions, check whether maintenance is keeping up before blaming the key.

    SYSTEM$CLUSTERING_INFORMATION is the check. Its average_depth and average_overlaps fields rise as the table gets worse, and a clustering_errors array says why reclustering could not run, for example because the clustering service had been disabled. Given a column list, it also works on a table with no key, which lets you test a candidate column before defining it.

    Caching appears in the profile and history as work that never happened. A repeated query can be answered from the persisted result, and the profile then shows a single Query Result Reuse step instead of an operator tree. Reuse is fragile. The text must match exactly, so a different case or a table alias defeats it. Functions such as UUID_STRING and RANDOM rule it out, the underlying data must be unchanged, and so must the table's micro-partitions, which a recluster rewrites. Each reuse resets the 24-hour retention, up to 31 days from the first run. When you benchmark a change, set USE_CACHED_RESULT to FALSE, or the second run measures the cache rather than your fix.

    Warehouse cache hits are a different measurement. percentage_scanned_from_cache in QUERY_HISTORY runs from 0.0 to 1.0, and a low value on a warehouse that repeats similar queries means its cache is being dropped too often.

    Checkpoint 1 of 9· Check yourself

    A nightly report has slowed down. In its Query Profile, the Most Expensive Nodes pane shows a Join taking about 70% of execution time. Each TableScan feeding it takes under 5%, and the join outputs roughly as many rows as its inputs. What should you do first?

    Checkpoint 2 of 9· Fill the gap

    This query should list only the warehouses that had queries waiting in a queue over the past month. Which column completes the HAVING clause?

    SELECT TO_DATE(start_time) AS date,
      warehouse_name,
      SUM(avg_running) AS sum_running,
      SUM(avg_queued_load) AS sum_queued
    FROM snowflake.account_usage.warehouse_load_history
    WHERE TO_DATE(start_time) >= DATEADD(month,-1,CURRENT_TIMESTAMP())
    GROUP BY 1,2
    HAVING SUM( ? ) >0;

    Checkpoint 3 of 9· Exam question

    An architect opens the Query Profile for a report that has slowed from 4 seconds to 90 seconds after a data volume increase. The profile shows one TableScan operator consuming 85% of total execution time, with a low percentage of partitions pruned relative to partitions scanned. What does this pattern indicate, and what should the architect try first?

    Checkpoint 4 of 9· Exam question

    In the Query Profile's execution details panel, an architect sees a node labeled Join at the top of the "Most Expensive Nodes" list, consuming 70% of the total query time, while the TableScan nodes feeding it each consume under 5%. What should the architect conclude about where to focus tuning effort?

    Checkpoint 5 of 9· Exam question

    A reporting query joins an ORDERS table (50 million rows) to an ORDER_ITEMS table (400 million rows) on order_id. In the Query Profile, the Join operator reports output rows far larger than the sum of its two input row counts, and the operator's time share dominates the profile. Which two conclusions and actions are appropriate to draw from this profile evidence? (Select 2)(Select 2)

    0 of 2 selected

    Sources12345

    2.Warehouse size, spilling and resizing

    Size sets the compute and memory one query can use. A larger warehouse gives a query or set of queries more resources. Memory matters most. When a warehouse runs out of memory, the query spills bytes to storage and runs substantially slower. Nonzero spill in the profile is a sizing signal. Moving to the next size up gives the query more memory, and you confirm the fix by re-running the query and comparing execution time.

    Resizing works in both directions, and nothing scales down by itself. On a single-cluster warehouse, more load means either a bigger warehouse or extra warehouses with users redirected to them. Once the peak passes, you have to downsize or suspend them yourself to stop paying for them. Sizing is easier when a warehouse runs similar workloads. On a warehouse that mixes very different queries, a costly upgrade can be wasted on queries that don't benefit from it. That is a reason to give heavy jobs their own warehouse rather than enlarging a shared one.

    Spilling has two grades, and the grade sets the urgency. When an operation such as duplicate elimination on a huge data set outgrows the memory of the warehouse's servers, intermediate results go to local disk. If local disk is also too small, they go to remote cloud storage, which is slower still. The Query Profile shows which operator nodes cause the spill, so you can tell one memory-hungry aggregate from a plan that is memory-bound throughout. In the per-node time breakdown, local_disk_io and remote_disk_io show how long processing sat blocked on each kind of disk.

    Across many queries, QUERY_HISTORY carries bytes_spilled_to_local_storage and bytes_spilled_to_remote_storage. Sort by the remote column first, since that is where the damage is. Snowflake also raises query insights for the worst cases: a Remote spillage insight, and one for queries that waited too long in the warehouse queue. Both recommend a larger warehouse. One exception: with query acceleration enabled, a small nonzero remote spill appears on eligible queries and is not a problem.

    Turn the finding into a recommendation by asking what is short. Memory is short when spill is present, so use a larger warehouse, or process the data in smaller batches if a larger one is not an option. Concurrency is short when queued_overload_time is high and nothing spills. That is a different fix, covered in the next section.

    Checkpoint 6 of 9· Check yourself

    A heavy monthly aggregation runs alone on a dedicated Medium warehouse. Its Query Profile shows nonzero bytes spilled to storage, and the scans prune well. Which plan addresses this bottleneck correctly?

    Sources678910

    3.Queuing and multi-cluster warehouses

    Queuing is a concurrency problem, not a speed problem. A warehouse hands resources to each submitted query. When there aren't enough for all of them, the rest wait, and that wait counts toward elapsed time even though no work is happening. Query history shows it as queued time, and the Warehouse Activity chart in Snowsight shows whether queries were queued. If queuing is the problem, a larger size is the wrong lever. The fix is more clusters (scaling out), or fewer queries running at once on that warehouse.

    A multi-cluster warehouse has a minimum and a maximum cluster count. Every cluster is the warehouse's size, and resizing the warehouse resizes every cluster. Larger sizes allow fewer clusters: XSMALL through MEDIUM allow 300, LARGE allows 160, and 4XLARGE and above allow 10. The worst case on cost is size multiplied by maximum clusters. A Medium warehouse with 3 clusters can use up to 12 credits per hour if all three run all hour. You pay only for the clusters actually running. Auto-suspend and auto-resume apply to the whole warehouse, not to individual clusters. The warehouse resumes automatically when new queries arrive. Which of these features your edition offers is covered in Snowflake editions and compliance (PCI DSS, PII/PHI).

    The two multi-cluster modes
    ModeHow it is setBehaviourFits
    MaximizedMinimum = maximum (greater than 1)All clusters start when the warehouse startsMany concurrent users whose numbers don't fluctuate much
    Auto-scaleMaximum greater than minimumClusters start as queries begin to queue and shut down as load drops; SCALING_POLICY controls howConcurrency that peaks and falls, such as business hours versus off hours

    Start small with Auto-scale, for example a minimum of 1 and a maximum of 2 or 3. Then raise the bounds once the load history shows where your real concurrency peaks and troughs are.

    Checkpoint 7 of 9· Match them up

    Match each multi-cluster warehouse setting or action to how it behaves.

    Tap a term, then the definition that fits it.

    Sources76

    4.Query acceleration and Snowpark-optimized warehouses

    The query acceleration service (QAS) is for outliers. These are the occasional queries that use far more resources than a warehouse's typical query. Instead of sizing the whole warehouse for them, QAS moves parts of their work to shared serverless compute that the service provides. It is enabled with ENABLE_QUERY_ACCELERATION = TRUE on CREATE or ALTER WAREHOUSE. Eligible queries follow two patterns: large scans with an aggregation or a selective filter, and large scans that insert or copy many rows. Common reasons a query is ineligible are too few partitions to scan, filters that aren't selective enough, a GROUP BY with too-high cardinality, and nondeterministic functions such as SEQ or RANDOM. That makes QAS a fit for ad-hoc analytics where data volume is unpredictable.

    The scale factor caps how much QAS can spend. QAS can raise a warehouse's credit consumption rate, and QUERY_ACCELERATION_MAX_SCALE_FACTOR limits it. The value is 8 when you set ENABLE_QUERY_ACCELERATION = TRUE explicitly, and 2 when Snowflake enables QAS automatically on Gen2 or multi-cluster warehouses at creation. Before enabling it, check whether it would help. The QUERY_ACCELERATION_ELIGIBLE view ranks the queries and warehouses with the most eligible time. SYSTEM$ESTIMATE_QUERY_ACCELERATION takes a query ID from the last 14 days and returns estimated run times at each scale factor, or an ineligibleReason such as NO_LARGE_ENOUGH_SCAN.

    Asking whether a past query would benefit from QAS, and at which scale factorssql
    SELECT PARSE_JSON(SYSTEM$ESTIMATE_QUERY_ACCELERATION('8cd54bf0-1651-5b1c-ac9c-6a9582ebd20f'));

    Snowpark-optimized warehouses answer a different question: whether one node has enough memory. By default they give 16x the memory per node of a standard warehouse. Through RESOURCE_CONSTRAINT you can go up to 256GB (MEMORY_16X, minimum size M) or 1TB (MEMORY_64X, minimum size L), and choose an x86 CPU architecture. They are meant for Snowpark code with large memory needs or a dependency on a specific CPU architecture, for example ML training in a stored procedure on a single node. UDF and UDTF workloads may also benefit. Workloads that don't use Snowpark may not, and creating or resuming one of these warehouses can take longer than a standard warehouse. That makes them a poor default for ordinary SQL.

    Checkpoint 8 of 9· Check yourself

    Most queries on an analytics warehouse finish quickly at its current size. A few times a day, analysts run ad-hoc SQL queries that scan very large tables with highly selective filters. These queries use far more resources than the rest. The profile shows no queuing and no spilling. Which change fits this workload best?

    Sources1112

    5.Cache layers, expiration and auto-suspend

    Snowflake has three cache layers, and each one expires in a different way.

    • Result cache (persisted query results). If a query is repeated and the underlying table data has not changed, Snowflake returns the previous result without running the query again. Results of every size expire after 24 hours.
    • Metadata. Some queries are answered entirely from metadata, such as SELECT COUNT(*) FROM … or SELECT CURRENT_DATABASE(). A virtual warehouse never processes them.
    • Warehouse cache. A running warehouse caches table data so later queries on the same warehouse can read from the cache instead of from tables. The cache is dropped when the warehouse suspends.

    That last point is what makes auto-suspend a performance setting as well as a cost setting. A short suspend window saves idle credits but throws away the cache. A long window keeps the cache but bills the warehouse while it sits idle. Look at percentage_scanned_from_cache in QUERY_HISTORY. If a warehouse runs frequent, similar queries and that percentage is low, the warehouse may be suspending too often. Set the window from how often queries arrive. If a query comes every 30 minutes, a 10-minute window pays for idle time and still loses the cache before the next query. The SQL parameter is in seconds, not minutes.

    Recommended auto-suspend settings by workload
    WorkloadAuto-suspendReason
    TasksImmediateNo users waiting to reuse the cache
    DevOps, DataOps, Data ScienceAbout 5 minutesAd-hoc, one-off queries gain little from the cache
    BI and SELECT query warehousesAt least 10 minutesKeeps the cache warm for users
    Setting a 10-minute auto-suspend (the value is in seconds)sql
    ALTER WAREHOUSE my_wh SET AUTO_SUSPEND = 600;

    Checkpoint 9 of 9· Match them up

    An administrator is setting auto-suspend on four warehouses. Pair each workload with the setting that fits it, and with the reason.

    Tap a term, then the definition that fits it.

    Sources5213

    Sources

    (14)

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “You can programmatically access the performance statistics of the Query Profile by executing the GET_QUERY_OPERATOR_STATS function.”
      ↩︎ Reading the Query Profile and query history
      “Be aware that the ACCOUNT_USAGE views are not updated immediately after running a query or task.”
      ↩︎ Reading the Query Profile and query history
      “It includes a Most Expensive Nodes pane that identifies the operator nodes that are taking the longest to execute.”
      ↩︎ Key concept
      “It includes a Most Expensive Nodes pane that identifies the operator nodes that are taking the longest to execute.”
      ↩︎ Exam trap 1
      “It includes a Most Expensive Nodes pane that identifies the operator nodes that are taking the longest to execute.”
      ↩︎ Checkpoint
    2. 2.
      “the Join operator produces significantly (often by orders of magnitude) more tuples than it consumes.”
      ↩︎ Reading the Query Profile and query history
      “or providing a condition where records from one table match multiple records from another table”
      ↩︎ Reading the Query Profile and query history
      “UNION ALL simply concatenates inputs, while UNION does the same, but also performs duplicate elimination.”
      ↩︎ Reading the Query Profile and query history
      “These queries are not processed by a virtual warehouse.”
      ↩︎ Cache layers, expiration and auto-suspend
    3. 3.
      “Snowflake only performs automated maintenance if the table will benefit from the operation.”
      ↩︎ Reading the Query Profile and query history
    4. 4.
      “A high number indicates the table is not well-clustered.”
      ↩︎ Reading the Query Profile and query history
      “The error describes why automatic clustering was not able to recluster data.”
      ↩︎ Reading the Query Profile and query history
    5. 5.
      “Any difference in syntax, including lowercase versus uppercase, or the use of table aliases, will inhibit 100% cache reuse.”
      ↩︎ Reading the Query Profile and query history
      “Snowflake resets the 24-hour retention period for the result, up to a maximum of 31 days”
      ↩︎ Reading the Query Profile and query history
      “By default, result reuse is enabled, but can be overridden at the account, user, and session level using the USE_CACHED_RESULT session parameter.”
      ↩︎ Reading the Query Profile and query history
      “For persisted query results of all sizes, the cache expires after 24 hours.”
      ↩︎ Cache layers, expiration and auto-suspend
      “Any difference in syntax, including lowercase versus uppercase, or the use of table aliases, will inhibit 100% cache reuse.”
      ↩︎ Exam trap 2
    6. 6.
      “a query runs substantially slower when a warehouse runs out of memory”
      ↩︎ Warehouse size, spilling and resizing
      “the cost of a performance enhancement might be wasted on a query that does not benefit from the optimization.”
      ↩︎ Warehouse size, spilling and resizing
      “the time between submitting a query and getting its results is longer when the query must wait in a queue before starting.”
      ↩︎ Queuing and multi-cluster warehouses
      “a query runs substantially slower when a warehouse runs out of memory, which results in bytes “spilling” onto storage.”
      ↩︎ Checkpoint
    7. 7.
      “you must manually downsize the larger warehouse or suspend the additional warehouses.”
      ↩︎ Warehouse size, spilling and resizing
      “For example, the maximum number of credits consumed per hour for a Medium-size multi-cluster warehouse with 3 clusters is 12 credits.”
      ↩︎ Queuing and multi-cluster warehouses
      “note that this does not apply to individual clusters, but rather the entire multi-cluster warehouse.”
      ↩︎ Queuing and multi-cluster warehouses
      “Auto-resuming a suspended warehouse when new queries are submitted.”
      ↩︎ Queuing and multi-cluster warehouses
      “Snowflake automatically starts additional clusters, up to the maximum number defined for the warehouse.”
      ↩︎ Exam trap 3
      “Snowflake queues the additional queries until the necessary resources become available.”
      ↩︎ Prediction
      “This mode is enabled by specifying different values for maximum and minimum number of clusters.”
      ↩︎ Checkpoint
    8. 8.
      “If the query requires even more memory, it spills onto remote cloud-provider storage, which results in even worse performance.”
      ↩︎ Warehouse size, spilling and resizing
      “You can use the Query Profile to identify which operation nodes are causing data to spill to storage.”
      ↩︎ Warehouse size, spilling and resizing
    9. 9.
      “If using a larger warehouse is not an option, change the query to process data in smaller batches.”
      ↩︎ Warehouse size, spilling and resizing
    10. 10.
      “Time during which processing was blocked while waiting for remote disk access.”
      ↩︎ Warehouse size, spilling and resizing
    11. 11.
      “by reducing the impact of outlier queries, which are queries that use more resources than the typical query.”
      ↩︎ Query acceleration and Snowpark-optimized warehouses
      “The scale factor is 8 when you explicitly set ENABLE_QUERY_ACCELERATION = TRUE in CREATE WAREHOUSE.”
      ↩︎ Query acceleration and Snowpark-optimized warehouses
      “The query acceleration service might increase the credit consumption rate of a warehouse. The maximum scale factor can help limit the consumption rate.”
      ↩︎ Query acceleration and Snowpark-optimized warehouses
    12. 12.
      “The default configuration for a Snowpark-optimized warehouse provides 16x memory per node compared to a standard warehouse.”
      ↩︎ Query acceleration and Snowpark-optimized warehouses
      “Initial creation and resumption of a Snowpark-optimized virtual warehouse might take longer than standard warehouses.”
      ↩︎ Query acceleration and Snowpark-optimized warehouses
    13. 13.
      “the cache is dropped when the warehouse is suspended.”
      ↩︎ Cache layers, expiration and auto-suspend
      “Use the ALTER WAREHOUSE command to change the auto-suspend time limit, which is specified in seconds, not minutes.”
      ↩︎ Cache layers, expiration and auto-suspend
      “Keep in mind that a running warehouse consumes credits even if it is not processing queries.”
      ↩︎ Exam trap 4
      “For query warehouses, for example BI and SELECT use cases, Snowflake recommends setting auto-suspend to at least 10 minutes to maintain the cache for users.”
      ↩︎ Checkpoint

    Also cited

    Continue to part 2 of 2

    Clustering keys and search optimization in Snowflake

    Spotted a mistake, or was something unclear? Tell us.