Snowflake

How to Use Query Profile: Snowflake Query Performance Analysis Guide

2026-03-21
更新: 2026-03-27
NicheeLab Editorial Team

Query Profile is Snowflake's performance analysis tool that visually surfaces a query's execution plan and runtime statistics. In the Snowsight UI, you can inspect processing time, partitions scanned, and spill volume for each operator to pinpoint bottlenecks.

This article walks through how to read Query Profile in the Snowsight UI, how to identify Most Expensive Nodes, how to check partition pruning, how to analyze spill, and a step-by-step bottleneck identification flow. It is a frequently tested topic in the Performance Concepts domain of the SnowPro exams.

How to Access Query Profile

You inspect Query Profile in Snowsight (the web UI).

  1. From the Snowsight left menu, open Activity → Query History
  2. Search for the query you want to analyze and click it
  3. Select the Query Profile tab to display the DAG (directed acyclic graph) view

When you run SQL from a Worksheet, you can jump straight in via the Query Profile link next to the results tab. To pull Query Profile statistics from SQL, use the GET_QUERY_OPERATOR_STATS() table function.

-- Retrieve Query Profile statistics from SQL
SELECT *
FROM TABLE(GET_QUERY_OPERATOR_STATS('01b2c3d4-0001-abcd-0000-00012345abcd'));

Components of the DAG View

Query Profile shows each processing step as an operator (node) and connects them with arrows representing data flow, producing a DAG (directed acyclic graph).

OperatorDescriptionWhat to check
TableScanReads data from a tablePartitions Scanned vs Total Partitions (pruning efficiency)
JoinFilterJOIN processingRows Produced and spill volume
FilterFiltering via WHERE clauseInput rows vs output rows (selectivity)
SortORDER BY processingSpill volume (sign of memory pressure)
AggregateGROUP BY and aggregate functionsCardinality and spill volume
ResultFinal result outputRows Produced
WithClause / WithReferenceCTE processingNumber of times the CTE result is reused

Identifying Most Expensive Nodes

Snowsight shows each node's share of total query processing time as a percentage and highlights the nodes that consumed the most resources in color.

Common Bottleneck Patterns

Cause of Most ExpensiveSignal in Query ProfileFix
Full table scanPartitions Scanned = Total PartitionsAdd a WHERE clause; set a clustering key
Large JOIN explosionJoinFilter Rows Produced is dramatically larger than the inputRevisit JOIN conditions; push filters earlier
Remote SpillBytes Spilled to Remote Storage is largeSize up the warehouse; optimize the query
Sort processing large data volumesSort spill volume is largeRemove unnecessary ORDER BY clauses; add LIMIT

Checking Partition Pruning

Partition pruning is the optimization that skips reading unnecessary micro-partitions based on WHERE clause conditions. In Query Profile, check the following values on the TableScan operator.

  • Partitions TotalTotal number of partitions in the table
  • Partitions ScannedNumber of partitions actually scanned

Partitions Scanned / Partitions Total — the lower this ratio, the better pruning is working. When the ratio is close to 100%, setting a clustering key is effective.

-- Example: verifying pruning effectiveness
-- Set a clustering key on the column used in WHERE
ALTER TABLE large_events CLUSTER BY (event_date);

-- Check clustering state
SELECT SYSTEM$CLUSTERING_INFORMATION('large_events', '(event_date)');

Spill Analysis

Spill happens when data that does not fit in memory during query execution gets written out to disk. It is one of the biggest causes of performance degradation.

Spill typeDestinationPerformance impactFix
Local SpillWarehouse local SSDModerate latencySize up the warehouse
Remote SpillCloud storage (S3/Blob/GCS)Severe latencySignificant size-up or query redesign

On each Query Profile operator, check the values of Bytes Spilled to Local Storage and Bytes Spilled to Remote Storage. If Remote Spill is occurring, sizing up the warehouse is the top-priority fix.

Bottleneck Identification Flow

  1. Open Query Profile — select the target query from Snowsight Query History or a Worksheet
  2. Inspect Most Expensive Nodes — locate the color-highlighted nodes in the DAG view
  3. Check whether spill is occurring — verify whether Bytes Spilled to Local/Remote Storage is non-zero
  4. Check partition pruning — check the Partitions Scanned vs Total ratio on TableScan
  5. Apply countermeasures — apply one of: size-up, clustering key, or query optimization
  6. Verify the improvement — re-run the same query and confirm the improvement in Query Profile

Query Analysis via SQL

-- Top 10 longest-running queries in the last 24 hours
SELECT query_id, query_text, total_elapsed_time / 1000 AS elapsed_sec,
       bytes_spilled_to_local_storage, bytes_spilled_to_remote_storage,
       partitions_scanned, partitions_total
FROM snowflake.account_usage.query_history
WHERE start_time > DATEADD(hour, -24, CURRENT_TIMESTAMP())
  AND execution_status = 'SUCCESS'
ORDER BY total_elapsed_time DESC
LIMIT 10;

Sample Question

Query Profile

問題 1

In a Snowflake Query Profile, the TableScan operator shows "Partitions Scanned = 1,000 / Partitions Total = 1,000". Which is the most appropriate fix?

  1. Size up the Virtual Warehouse to improve processing speed
  2. Enable Result Cache to speed up re-runs of the same query
  3. Set a clustering key on a column you frequently filter on in WHERE to improve partition pruning efficiency
  4. Enable a multi-cluster warehouse to scale out

正解: C

Partitions Scanned = Partitions Total (0% pruning) means WHERE clause conditions are not narrowing partitions at all. In this case, setting a clustering key on a column you frequently use in WHERE rearranges data within micro-partitions and dramatically improves pruning efficiency. Sizing up the warehouse (A) raises read parallelism but does not reduce scanned volume. Result Cache (B) only helps on re-runs of the same query and does not address the root cause. Scaling out (D) improves concurrency but has no effect on the scan efficiency of a single query.

Try Query Profile practice questions

Check your SnowPro readiness with the bilingual question bank

Try free questions

Frequently Asked Questions

Where can I access Query Profile?

Query Profile is available from Query History in Snowsight (the web UI). In Snowsight, open Activity → Query History, click the query you want to analyze, and the Query Profile tab appears. If you ran the query from a Snowsight Worksheet, you can also jump straight to it from the Query Profile link next to the results tab. SnowSQL and JDBC/ODBC clients cannot open Query Profile directly, but you can pull the same per-operator statistics from SQL using the GET_QUERY_OPERATOR_STATS() table function.

What is spill, and how does it affect performance?

Spill happens when a query produces more data than fits in memory (RAM) and Snowflake temporarily writes it out to local disk or remote storage (S3/Azure Blob/GCS). Local Spill goes to local disk; Remote Spill goes to cloud storage. Remote Spill is dramatically slower than Local Spill and severely degrades query performance. When Query Profile shows spill, the fixes are: (1) size up the warehouse (more memory), (2) optimize the query (fewer JOINs, tighter filter conditions), and (3) reduce scanned data by setting a clustering key.

What are Most Expensive Nodes?

Most Expensive Nodes are the operators (processing nodes) inside Query Profile that consume the most resources. Snowsight highlights the nodes with the largest processing time or resource usage in color. The usual suspects are full table scans (TableScan), large JOINs (JoinFilter), sorts (Sort), and aggregations (Aggregate). The recommended bottleneck-tuning flow is to identify the Most Expensive Node first, then check its Partitions Scanned/Total ratio, spill volume, and Bytes Sent to pinpoint the root cause.

Related Query Profile Articles

Virtual Warehouse: Complete Guide

Warehouse sizing, scaling, and cost optimization

Clustering Keys: Complete Guide

How to set a clustering key and verify its effect

Result Cache: Complete Guide

How the three cache layers work and when to use each

Check what you learned with practice questions

Practice with certification-focused question sets

無料で問題を解いてみる
Author

NicheeLab Editorial Team

NicheeLab editorial team focused on data engineering and cloud certification learning. Content is structured around practical study needs and official exam domains.


Related articles
Snowflake

Snowflake Certifications: All 11 Exams Explained (2026)

Every SnowPro certification — Associate, Core, Specialty, Ad...

Snowflake

Snowflake Exam Difficulty Ranking: All 11 Certs Compared (2026)

All 11 SnowPro exams ranked by difficulty with study-time es...

Snowflake

Snowflake Study Guide: Fastest Pass Route by Exam (2026)

How to pass SnowPro certifications efficiently — official ma...

Snowflake

SnowPro Core (COF-C03): Complete Exam Guide (2026)

Pass the SnowPro Core exam — six domains, scope, sample ques...

Snowflake

SnowPro Associate Platform (SOL-C01): Complete Guide (2026)

The entry-level SnowPro Associate exam — scope, weighting, s...

Browse all Snowflake articles (103)
© 2026 NicheeLab All rights reserved.