> For the complete documentation index, see [llms.txt](https://docs.paradime.io/app-help/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.paradime.io/app-help/products/dino-ai/tools-and-features/warehouse-tool/snowflake-query-analysis-tool.md).

# Snowflake Query Analysis Tool

The Snowflake Query Analysis Tool allows DinoAI to deep-dive into a specific Snowflake query by ID, giving you detailed performance and execution plan statistics to diagnose slow queries and warehouse contention without leaving the Paradime IDE.

This tool bridges the gap between noticing a performance issue and understanding its root cause, enabling DinoAI to analyze execution plans, surface bottlenecks, and suggest concrete fixes — from query rewrites to warehouse configuration changes.

{% hint style="info" %}
**This tool is built for query-level debugging.** If you need to explore warehouse metadata or run exploratory SQL, use the [Warehouse Tool](/app-help/documentation/dino-ai/tools-and-features/warehouse-tool.md) or [SQL Query Tool](/app-help/documentation/dino-ai/tools-and-features/warehouse-tool/sql-execution-tool.md) instead.
{% endhint %}

### Capabilities

The Snowflake Query Analysis Tool fetches detailed execution data for a given Snowflake query ID and returns it as a structured report DinoAI can reason over. Specifically, it:

* Breaks down execution time and phase timings
* Reports warehouse usage and resource consumption
* Surfaces cache efficiency
* Includes row counts and partition details
* Highlights spill metrics and queue times
* Provides operator-level statistics from the execution plan

### Using the Snowflake Query Analysis Tool

1. Open DinoAI in the right panel of the Code IDE
2. Provide the Snowflake query ID you want to analyze (e.g., `01a12345-0600-0000-0000-123456789abc`)
3. Add your prompt describing what you want DinoAI to focus on — bottlenecks, warehouse sizing, cache usage, and so on
4. Grant permission when DinoAI asks to access the query data
5. Review DinoAI's analysis and apply the suggested optimizations

{% @arcade/embed url="<https://app.arcade.software/share/hIviNRv9JwUxpJ77mN1d>" flowId="hIviNRv9JwUxpJ77mN1d" %}

### Example Use Cases

#### Diagnosing a Slow Query

**Prompt**

{% code overflow="wrap" %}

```
Analyze Snowflake query 01c2a115-0002-e622-0002-731a0090040a. Suggest optimizations.
```

{% endcode %}

**Result:** DinoAI fetches the execution plan and performance statistics for the query, identifies the most expensive phase or operator, and explains what is causing the slowdown in plain language — along with suggested fixes such as query rewrites, clustering keys, or partition pruning improvements.

#### Investigating Warehouse Contention

**Prompt**

{% code overflow="wrap" %}

```
Compare this query's queue time vs execution time. Suggest warehouse changes.
```

{% endcode %}

**Result:** DinoAI analyzes the queue and execution time breakdown, assesses whether the query is being held back by warehouse contention or undersizing, and recommends specific warehouse configuration changes such as scaling up, enabling auto-scaling, or adjusting query concurrency settings.

### Working with Other Tools

The Snowflake Query Analysis Tool works well alongside DinoAI's other capabilities to support your full debugging and optimization workflow:

* Combine with the **SQL Execution Tool** to re-run an optimized version of the query and validate the performance improvement
* Combine with the **Warehouse Tool** to cross-reference query performance with table metadata, clustering, and partition information
* Use alongside **Git Lite** to commit query or model changes made as a result of the performance analysis

### Best Practices

* **Use the Snowflake query ID** — Find the exact query ID in Snowflake's Query History under **Activity** → **Query History** to ensure DinoAI analyzes the right execution
* **Be specific about what to focus on** — Tell DinoAI whether you're investigating slow execution, high spill, long queue times, or poor cache efficiency to get the most targeted analysis
* **Iterate on fixes** — After applying a suggested change, re-run the query and analyze the new query ID to validate the improvement
* **Check spill metrics** — High local or remote spill is a common culprit for slow queries; ask DinoAI to highlight spill specifically if you suspect memory pressure


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.paradime.io/app-help/products/dino-ai/tools-and-features/warehouse-tool/snowflake-query-analysis-tool.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
