Database / Snowflake Interview Questions
What is the Snowflake Query Profile and how do you use it to diagnose slow queries?
Query Profile is Snowflake's built-in visual execution plan viewer, available in Snowsight under Query History for any completed or actively running query. It shows the full operator tree for a query execution — every node representing a distinct processing step — along with timing, row counts, and resource metrics at each step. It is your first stop when a query is slower than expected.
Key operator node types: TableScan (reads micro-partitions), Filter, Aggregate, Join, Sort, Exchange (shuffle data between nodes), Projection.
The most important diagnostic signals:
- Partitions Scanned vs Partitions Total — if scanned is close to total, the query is not pruning well. Consider adding a clustering key on the filter columns.
- Bytes Spilled to Local Storage — the warehouse ran out of in-memory space for intermediate results; consider scaling up the warehouse size.
- Bytes Spilled to Remote Storage — even worse spilling to cloud storage; a significantly larger warehouse or a query rewrite is needed.
- Bytes Sent over Network in Join nodes — large data shuffle between nodes; pushing down more filters earlier can reduce this.
- Compilation Time vs Execution Time — very high compilation time relative to execution indicates a complex query plan; simplify CTEs or break into steps.
- % of execution per node — a single node consuming 90%+ of time is the bottleneck; focus optimization there.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
