Sql Performance Review
by hubert-dudek
Review and improve Databricks SQL queries for correctness, readability, and performance (joins, filters, aggregations, partition pruning). Use when someone pastes a SQL query, asks why it is slow, or requests a rewrite/optimization in Databricks SQL.
Skill Details
Repository Files
3 files in this skill directory
name: sql-performance-review description: Review and improve Databricks SQL queries for correctness, readability, and performance (joins, filters, aggregations, partition pruning). Use when someone pastes a SQL query, asks why it is slow, or requests a rewrite/optimization in Databricks SQL. license: Proprietary. For internal team use. compatibility: Designed for Databricks Assistant agent mode. Works best when the user provides the SQL query and (optionally) table names, row counts, or query profile details. metadata: author: your-team version: "1.0"
Databricks SQL performance review
Use this skill when optimizing or reviewing SQL in Databricks SQL.
What to ask for (only if missing)
Ask up to 3 questions total:
- The query text (if not provided)
- The table(s) involved + their sizes (rough order of magnitude) OR the query profile / execution plan
- The desired result constraints (correctness, exactness, latency SLA)
If the user can’t provide sizes/plan, proceed with best-effort heuristics and call out assumptions.
Output format
Use the structure in assets/sql-review-output.md.
Checklist
Use references/sql-checklist.md to ensure you cover the common performance levers:
- predicate pushdown / partition pruning
- join strategy and join keys
- avoid
SELECT * - minimize shuffles / wide aggregations
- use correct data types and avoid implicit casts
- reduce data scanned (pre-filter, semi-joins, EXISTS)
Examples
User: “This query is slow in Databricks SQL. Can you optimize it?” (pastes query)
Assistant: Provide issues, suggestions, and a rewritten query, plus next steps (EXPLAIN, add ZORDER, etc.).
Edge cases
- If the query is logically wrong (duplicates from joins, missing filters), fix correctness first.
- If tables are Delta: suggest partitioning/ZORDER/OPTIMIZE only if it matches query patterns.
- If the user is in a governed environment: avoid suggestions that require elevated permissions unless noted.
Related Skills
Xlsx
Comprehensive spreadsheet creation, editing, and analysis with support for formulas, formatting, data analysis, and visualization. When Claude needs to work with spreadsheets (.xlsx, .xlsm, .csv, .tsv, etc) for: (1) Creating new spreadsheets with formulas and formatting, (2) Reading or analyzing data, (3) Modify existing spreadsheets while preserving formulas, (4) Data analysis and visualization in spreadsheets, or (5) Recalculating formulas
Clickhouse Io
ClickHouse database patterns, query optimization, analytics, and data engineering best practices for high-performance analytical workloads.
Clickhouse Io
ClickHouse database patterns, query optimization, analytics, and data engineering best practices for high-performance analytical workloads.
Analyzing Financial Statements
This skill calculates key financial ratios and metrics from financial statement data for investment analysis
Data Storytelling
Transform data into compelling narratives using visualization, context, and persuasive structure. Use when presenting analytics to stakeholders, creating data reports, or building executive presentations.
Team Composition Analysis
This skill should be used when the user asks to "plan team structure", "determine hiring needs", "design org chart", "calculate compensation", "plan equity allocation", or requests organizational design and headcount planning for a startup.
Startup Financial Modeling
This skill should be used when the user asks to "create financial projections", "build a financial model", "forecast revenue", "calculate burn rate", "estimate runway", "model cash flow", or requests 3-5 year financial planning for a startup.
Kpi Dashboard Design
Design effective KPI dashboards with metrics selection, visualization best practices, and real-time monitoring patterns. Use when building business dashboards, selecting metrics, or designing data visualization layouts.
Dbt Transformation Patterns
Master dbt (data build tool) for analytics engineering with model organization, testing, documentation, and incremental strategies. Use when building data transformations, creating data models, or implementing analytics engineering best practices.
Startup Metrics Framework
This skill should be used when the user asks about "key startup metrics", "SaaS metrics", "CAC and LTV", "unit economics", "burn multiple", "rule of 40", "marketplace metrics", or requests guidance on tracking and optimizing business performance metrics.
