CertSafari
    Snowflake SnowPro Core Certification (COF-C03)· Lessons

    Domain 4 · Lesson 13/19

    Reading the Query Profile: spilling, pruning and exploding joins

    Evaluate query performance

    13 min read
    5.25% of exam
    5 sources
    Published 20 Oct 2026
    Docs as of 18 Oct 2026

    What you will be able to do

    • Open the Query Profile for any past query and find its most expensive operator nodes
    • Use the Query Insights pane to identify the condition slowing a query
    • Tell local spilling from remote spilling and pick the right fix
    • Spot ineffective pruning by comparing partitions scanned with partitions total
    • Recognise an exploding join and trace it to its join condition

    Key concept

    Query Profile — The Query Profile is a per-query view of the execution plan. Each operator, such as TableScan, Join or Aggregate, appears as a node with its own statistics, so you can see which step took the time and why.

    1.Opening the Query Profile for any query

    Evaluating a slow query starts with its Query Profile. The profile shows how Snowflake actually ran the query as a tree of operator nodes, and the statistics on each node tell you where the time went. Guessing from the SQL text alone can't do that.

    The profile is stored with the query, not with the worksheet, so you can open it after the user's session has closed. In Snowsight:

    1. Select Monitoring » Query History in the navigation menu.
    2. Select the query ID of the query.
    3. Select the Query Profile tab.

    The first place to look is the Most Expensive Nodes pane, which ranks operators by execution time. From a node you can drill into the share of its time spent in each processing category: Processing (CPU), Local Disk IO, Remote Disk IO, Network Communication, Synchronization and Initialization. A node that spends most of its time in Remote Disk IO is telling you something different from one that is busy in Processing.

    The same numbers are available in SQL. The GET_QUERY_OPERATOR_STATS table function returns one row per operator, with columns such as OPERATOR_TYPE, OPERATOR_STATISTICS and EXECUTION_TIME_BREAKDOWN. Because it is a table function, you wrap it in TABLE(), for example SELECT * FROM TABLE(GET_QUERY_OPERATOR_STATS(last_query_id())).

    Checkpoint 1 of 8· Put it in order

    A user says a query they ran yesterday was slow, and their session has since closed. Put the Snowsight steps for opening that query's Query Profile in order.

    1. 1.Select the query ID of the slow query
    2. 2.In the navigation menu, select Monitoring » Query History
    3. 3.Select the Query Profile tab

    Sources123

    2.Query insights: Snowflake's own diagnosis

    When Snowflake detects a condition that affects a query's performance, it records a query insight. Each insight gives a message about the condition, the part of the query that caused it, and a suggested next step. In the Query Profile tab, nodes that have insights are highlighted. The Query Insights pane on the right lists every instance, and View opens the details. The same data can be queried from the QUERY_INSIGHTS view, where the INSIGHT_TOPIC column groups the insights by topic.

    Insight topics and some of the insight types under each
    INSIGHT_TOPICExample insightWhat it points at
    TABLE_SCANNo filter on table scan / Filter not applicable / Filter not selectiveThe scan reads more data than the query needs
    TABLE_SCANLIKE filter with leading wildcardA pattern such as '%abc' forces a large scan
    JOINJoin with no join condition / Exploding joinA join produces far more rows than its inputs
    AGGREGATIONUnnecessary aggregationDISTINCT or GROUP BY that changes nothing
    UNIONUnnecessary UNION [ DISTINCT ] clauseDisjoint inputs; UNION ALL would do
    WAREHOUSERemote spillage / Query was in the queue for the warehouse for too longThe warehouse lacked memory or capacity

    Some queries get no insights at all. Queries that reuse results, EXPLAIN queries, queries involving secure objects, queries against hybrid tables, queries generated by Native Apps and queries whose plan takes multiple steps all fall into this group. Snowflake also skips the "filter not selective" insight for queries accelerated by the query acceleration service. So an empty Query Insights pane does not prove the query is healthy. It may just mean the query is one Snowflake doesn't analyse.

    Checkpoint 2 of 8· Check yourself

    An analyst's query against a secure view ran for 20 minutes. When you open its Query Profile, the Query Insights pane is empty. What should you conclude?

    Sources4

    3.Bytes spilled to local and remote storage

    Spilling happens when an operation's intermediate results don't fit in the warehouse's memory. Snowflake writes the overflow to disk in two stages, and each stage is slower than the one before. First it spills to the warehouse's local disk. If even that isn't enough, it spills to remote cloud-provider storage, which makes performance worse again.

    The Query Profile's statistics pane shows both stages under Spilling: "Bytes spilled to local storage" and "Bytes spilled to remote storage". To find the operator responsible, look for the node that has these statistics, usually a heavy Aggregate, Sort or Join. Its execution-time breakdown will show the time going to Local Disk IO or Remote Disk IO. Local spilling alone already slows the query a lot. A large remote figure is the more serious case, because those intermediate results are going over the network to cloud storage instead of to the warehouse's own disk.

    Spilling is a memory problem inside one query, so it has two fixes. The first is a larger warehouse, which gives that query more memory and local storage. The second is processing the data in smaller batches when resizing isn't an option. Spillage is the symptom that calls for scaling up rather than out (Scale up vs scale out). Adding clusters to a multi-cluster warehouse lets more queries run at once, but it gives no single query more memory. Once a resize is in place, rerun the query. If both spill counters drop to zero, the working set now fits in memory.

    Checkpoint 3 of 8· Check yourself

    Two nightly jobs show spilling in their Query Profiles. Job A spilled 30 GB to local storage and nothing to remote storage. Job B spilled 4 GB to local storage and 3 GB to remote storage. Which job has the more serious memory problem, and why?

    Checkpoint 4 of 8· Exam question

    An analyst runs a large GROUP BY aggregation on an X-Small warehouse. The Query Profile statistics pane reports 40 GB under "Bytes spilled to local storage" and the Aggregate node dominates execution time. What is the most effective first change to try?

    Checkpoint 5 of 8· Exam question

    Two completed queries both show spilling in their Query Profile statistics pane. Query 1 shows only nonzero "Bytes spilled to local storage." Query 2 shows a large nonzero value under "Bytes spilled to remote storage." Which statement correctly compares their severity?

    Sources52

    4.Spotting inefficient pruning

    Pruning is how Snowflake skips micro-partitions that can't contain matching rows, using the metadata kept for each partition (Micro-partitions, pruning and clustering depth). Its effect shows in the Pruning statistics on a TableScan node. Partitions scanned is the number of partitions read, and Partitions total is the number of partitions in the table.

    The ratio between the two tells you how well pruning worked. Suppose a report filters on a single date but the TableScan shows 9,800 partitions scanned out of 10,000. The filter cut out almost nothing at the storage level, and the query paid to read nearly the whole table. This isn't spilling, which shows up in different counters, and it isn't queuing, which happens before execution starts. When pruning works, the scanned count is a small fraction of the total.

    Query insights flag the scan-side causes. No filter on table scan means there is no WHERE clause at all. Filter not applicable means the WHERE clause removed no rows. Filter not selective means it removed only a few. LIKE filter with leading wildcard means a pattern such as '%abc' forced a large scan. In each case the suggested next step is a more selective condition. For leading wildcards that can't be avoided, Snowflake suggests search optimization. The positive insight Filter uses clustering key confirms that a query benefited from filtering on the table's clustering key. Fixing poor pruning with clustering is covered in query optimization.

    Checkpoint 6 of 8· Match them up

    Query insights under the TABLE_SCAN topic each point to a different scan-side cause of poor pruning. Match each insight to the condition it reports.

    Tap a term, then the definition that fits it.

    Checkpoint 7 of 8· Exam question

    In the Query Profile for a slow report query, a TableScan node shows "Partitions scanned: 9,800" out of "Partitions total: 10,000" even though the query filters on a single date column. What does this indicate?

    Sources24

    5.Exploding joins

    An exploding join is a Join node whose output has far more rows than its inputs. In the profile, compare the rows going into the Join with the rows coming out. A join that multiplies rows forces every operator above it to process that inflated set. It also tends to cause spilling, because the extra rows have to fit somewhere.

    The usual cause is the join condition. With no condition at all, the join becomes a cross join that returns every combination of rows. Snowflake flags this as Join with no join condition. A wrong or too-loose condition produces Exploding join (not nested), meaning a join of two data sets returns many more rows than they contain. Exploding join (nested join) means a join that consumes the output of other joins is exploding. The problem then usually sits in the child joins' conditions, and the fix belongs there. A WHERE clause on a subquery feeding the join can also cut the rows. A filter applied several steps later removes rows only after the expensive join has already made them.

    To check a complex query in SQL, use GET_QUERY_OPERATOR_STATS to compute each Join operator's ratio of output rows to input rows. Any join with a large multiple is a candidate, and its condition should be checked first.

    Ratio of output rows to input rows for every Join operator in a querysql
    SELECT  operator_id,
            operator_attributes,
            operator_statistics:output_rows / operator_statistics:input_rows AS row_multiple
      FROM TABLE(GET_QUERY_OPERATOR_STATS($lid))
      WHERE operator_type = 'Join'
      ORDER BY step_id, operator_id;

    A different JOIN insight, Join with inefficient join condition, is not about row counts. It means a complex condition is evaluated after the data sets are joined, when evaluating it before the join would reduce the work. The suggested fix is to simplify the condition.

    Checkpoint 8 of 8· Check yourself

    A reporting query joins five tables. Its Query Profile flags "Exploding join (nested join)" on the top Join node, which takes its input from two other joins. Three operators later, a Filter removes 95% of the rows. What fix does this insight point to?

    Sources43

    Sources

    (5)

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

    1. 1.
      “It includes a Most Expensive Nodes pane that identifies the operator nodes that are taking the longest to execute.”
      ↩︎ Opening the Query Profile for any query
      “You can programmatically access the performance statistics of the Query Profile by executing the GET_QUERY_OPERATOR_STATS function.”
      ↩︎ Opening the Query Profile for any query
      “The Query Profile allows you to examine which parts of a query are taking the longest to execute.”
      ↩︎ Key concept
      “In the navigation menu, select Monitoring » Query History.”
      ↩︎ Checkpoint
    2. 2.
      “Remote Disk IO — time when the processing was blocked by remote disk access.”
      ↩︎ Opening the Query Profile for any query
      “Bytes spilled to remote storage — volume of data spilled to remote disk.”
      ↩︎ Bytes spilled to local and remote storage
      “Partitions scanned — number of partitions scanned so far.”
      ↩︎ Spotting inefficient pruning
    3. 3.
      “Because this function is a table function, you must use it in a FROM clause and you must wrap it in TABLE().”
      ↩︎ Opening the Query Profile for any query
      “After you identify the exploding joins, you can review each join condition to verify that the condition is correct.”
      ↩︎ Exploding joins
    4. 4.
      “In Query Profile tab under Query History, you can view the insights for a query. The nodes that have corresponding insights are highlighted.”
      ↩︎ Query insights: Snowflake's own diagnosis
      “Snowflake does not produce the “filter not selective” insight for queries that are accelerated by the query acceleration service.”
      ↩︎ Query insights: Snowflake's own diagnosis
      “A WHERE clause doesn’t filter out any rows, which means that the query might scan more data than intended.”
      ↩︎ Spotting inefficient pruning
      “If you need to specify a pattern that starts with a wildcard, consider enabling search optimization for more efficient pattern matching.”
      ↩︎ Spotting inefficient pruning
      “The join is missing the join condition. The result is a cross join, which returns every possible combination of rows.”
      ↩︎ Exploding joins
      “A join that includes the output of at least one other join is returning many more rows than are in the tables being joined.”
      ↩︎ Exploding joins
      “If using a larger warehouse is not an option, change the query to process data in smaller batches.”
      ↩︎ Exam trap 1
      “This might indicate a problem with the join conditions for the child joins.”
      ↩︎ Exam trap 3
      “Insights are not produced for: Queries for which the query plan takes multiple steps to finish. Queries involving secure objects.”
      ↩︎ Checkpoint
      “Unlike the Filter not applicable insight, this insight indicates that the WHERE clause is filtering out some rows but it could have been more selective.”
      ↩︎ Checkpoint
      “To prevent the join from producing more rows than the joined tables contain, add or change the join conditions for the child joins.”
      ↩︎ Checkpoint
    5. 5.
      “Performance degrades drastically when a warehouse runs out of memory while executing a query because memory bytes must “spill” onto local disk storage.”
      ↩︎ Bytes spilled to local and remote storage
      “You can use the Query Profile to identify which operation nodes are causing data to spill to storage.”
      ↩︎ Bytes spilled to local and remote storage
      “If the query requires even more memory, it spills onto remote cloud-provider storage, which results in even worse performance.”
      ↩︎ Exam trap 2
      “Using a larger warehouse (effectively increasing the available memory/local storage space for the operation)”
      ↩︎ Prediction
      “If the query requires even more memory, it spills onto remote cloud-provider storage, which results in even worse performance.”
      ↩︎ Checkpoint

    Continue to part 2 of 2

    Account-wide query analysis and workload grouping

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