snowflake-performance-tuning

Featured

Optimize Snowflake query performance with clustering, materialized views, caching, and query profiling. Use when queries are slow, analyzing QUERY_HISTORY for bottlenecks, or optimizing warehouse utilization and data scanning. Trigger with phrases like "snowflake performance", "optimize snowflake", "snowflake slow query", "snowflake clustering", "snowflake query profile".

AI & Automation 2,926 stars 433 forks Updated yesterday MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Snowflake Performance Tuning ## Overview Optimize Snowflake query performance using clustering keys, materialized views, result caching, query profiling, and warehouse tuning. ## Prerequisites - Access to `SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY` - Understanding of micro-partitions and pruning - Role with `MONITOR` privilege on warehouses ## Instructions ### Step 1: Identify Slow Queries ```sql -- Top 20 slowest queries in last 24 hours SELECT query_id, query_text, total_elapsed_time / 1000 AS seconds, bytes_scanned / 1e9 AS gb_scanned, partitions_scanned, partitions_total, ROUND(partitions_scanned / NULLIF(partitions_total, 0) * 100, 1) AS pct_scanned, warehouse_name, warehouse_size FROM SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY WHERE execution_status = 'SUCCESS' AND start_time >= DATEADD(hours, -24, CURRENT_TIMESTAMP()) AND query_type = 'SELECT' ORDER BY total_elapsed_time DESC LIMIT 20; -- Queries scanning too many partitions (poor pruning) SELECT query_id, query_text, partitions_scanned, partitions_total, bytes_scanned / 1e9 AS gb_scanned FROM SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY WHERE partitions_scanned > partitions_total * 0.5 AND partitions_total > 100 AND start_time >= DATEADD(hours, -24, CURRENT_TIMESTAMP()) ORDER BY partitions_scanned DESC LIMIT 10; ``` ### Step 2: Add Clustering Keys ```sql -- Clustering improves pruning for large tables (> 1TB) -- Choose columns used in WHERE and JOIN clauses -- Cluster by ...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
1 years ago
Last Updated
yesterday
Language
Python
License
MIT

Integrates with

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category

Data & Documents Listed

optimizing-snowflake-workloads

Reduce Snowflake cost and latency — right-size and auto-suspend warehouses, use multi-cluster for concurrency, apply clustering keys, read the Query Profile, exploit result/warehouse caching, and control credit spend. Use when Snowflake queries are slow or expensive, warehouses spill or queue, credits are high, or you need to size a warehouse.

27 Updated 2 months ago
Unknown-333
AI & Automation Featured

snowflake-advanced-troubleshooting

Apply advanced Snowflake debugging with query profiling, spill analysis, lock contention, and performance deep-dives using ACCOUNT_USAGE views. Use when standard troubleshooting fails, investigating slow queries, or diagnosing warehouse performance issues. Trigger with phrases like "snowflake hard bug", "snowflake slow query debug", "snowflake query profile", "snowflake spilling", "snowflake deep debug".

2,926 Updated yesterday
jeremylongshore
Data & Documents Listed

optimizing-query-by-id

Optimizes Snowflake query performance using query ID from history. Use when optimizing Snowflake queries for: (1) User provides a Snowflake query_id (UUID format) to analyze or optimize (2) Task mentions "slow query", "optimize", "query history", or "query profile" with a query ID (3) Analyzing query performance metrics - bytes scanned, spillage, partition pruning (4) User references a previously run query that needs optimization Fetches query profile, identifies bottlenecks, returns optimized SQL with expected improvements.

135 Updated 3 weeks ago
AltimateAI