@@ -7,7 +7,7 @@ description: Analyze Snowflake query costs and identify optimization opportuniti
77
88## Requirements
99** Agent:** any (read-only analysis)
10- ** Tools used:** sql_execute, sql_analyze, sql_predict_cost, sql_record_feedback
10+ ** Tools used:** sql_execute, sql_analyze, finops_analyze_credits, finops_expensive_queries, finops_warehouse_advice
1111
1212Analyze Snowflake warehouse query costs, identify the most expensive queries, detect anti-patterns, and recommend optimizations.
1313
@@ -47,7 +47,6 @@ Analyze Snowflake warehouse query costs, identify the most expensive queries, de
4747
48483 . ** Analyze the top offenders** - For each of the top 10 most expensive queries:
4949 - Run ` sql_analyze ` on the query text to detect anti-patterns (SELECT * , missing LIMIT, cartesian products, correlated subqueries, etc.)
50- - Run ` sql_predict_cost ` to get the cost tier prediction based on historical feedback data
5150 - Summarize anti-patterns found and their severity
5251
53524 . ** Classify each query into a cost tier** :
@@ -59,8 +58,7 @@ Analyze Snowflake warehouse query costs, identify the most expensive queries, de
5958 | 3 | $1.00 - $100.00 | Expensive | Optimize or review warehouse sizing |
6059 | 4 | > $100.00 | Dangerous | Immediate review required |
6160
62- 5 . ** Record feedback** - For each query analyzed, call ` sql_record_feedback ` to store the execution metrics so future predictions improve:
63- - Pass ` bytes_scanned ` , ` execution_time_ms ` , ` credits_used ` , and ` warehouse_size ` from the query history results
61+ 5 . ** Warehouse analysis** - Run ` finops_warehouse_advice ` to check if warehouses used by the top offenders are right-sized.
6462
65636 . ** Output the final report** as a structured markdown document:
6664
@@ -97,7 +95,7 @@ Analyze Snowflake warehouse query costs, identify the most expensive queries, de
9795 2. Add LIMIT clause
9896 3. Consider partitioning strategy
9997
100- **Cost prediction :** Tier 1 (fingerprint match, high confidence )
98+ **Cost tier :** Tier 1 (based on credits used )
10199
102100 ...
103101
@@ -113,4 +111,4 @@ The user invokes this skill with:
113111- ` /cost-report ` -- Analyze the last 30 days
114112- ` /cost-report 7 ` -- Analyze the last 7 days (adjust the DATEADD interval)
115113
116- Use the tools: ` sql_execute ` , ` sql_analyze ` , ` sql_predict_cost ` , ` sql_record_feedback ` .
114+ Use the tools: ` sql_execute ` , ` sql_analyze ` , ` finops_analyze_credits ` , ` finops_expensive_queries ` , ` finops_warehouse_advice ` .
0 commit comments