query-optimize

Optimize SQL queries with dialect-aware rewrites and semantic equivalence validation.

792|138|Updated Feb 27, 2026
One-click install
npx skills add https://github.com/AltimateAI/altimate-code --skill query-optimize-altimateai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: query-optimize
Source: https://github.com/AltimateAI/altimate-code/tree/main/.opencode/skills/query-optimize
Command: npx skills add https://github.com/AltimateAI/altimate-code --skill query-optimize-altimateai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Analyze and optimize SQL queries to improve performance and reduce cost while preserving correctness across data warehouses.

Core Features & Use Cases

  • End-to-end SQL optimization: analyze, rewrite, and validate query plans using schema context.
  • Provide execution plan insights and anti-pattern recommendations for complex queries.
  • Use cases include tuning large joins, eliminating full table scans, and improving latency in BI dashboards.

Quick Start

Provide a SQL query or path to a SQL file, and the skill will optimize and validate it end-to-end.

Frequently Asked Questions about query-optimize

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I optimize SQL queries to improve performance and reduce cost?

To optimize SQL queries, you analyze execution plans, apply dialect-aware rewrites, and use schema context to eliminate anti-patterns like full table scans, which reduces latency and cost while preserving result correctness.

What are common SQL anti-patterns that cause full table scans and slow dashboards?

Common SQL anti-patterns causing full table scans include poorly tuned large joins and unfiltered queries. Analyzing the execution plan helps identify these issues so you can rewrite the query to improve BI dashboard latency.

How do I validate that an optimized SQL query returns the same results as the original?

You validate an optimized SQL query by performing semantic equivalence checks. This ensures the rewritten query preserves result correctness and returns the exact same data as the original query before deployment.

Does this query optimization approach work across different data warehouse dialects?

Yes, query optimization applies dialect-aware analysis to ensure rewrites are valid across different data warehouses. It evaluates execution plans and schema context specific to the dialect to improve performance.

What is the best way to tune large joins in complex SQL queries?

The best way to tune large joins in SQL queries is to inspect the schema context and execution plan to identify bottlenecks, then apply concrete rewrites that eliminate full table scans and improve overall latency.

Why does my SQL query execution plan show a full table scan?

An SQL query execution plan shows a full table scan when the query lacks proper filtering or uses anti-patterns in large joins. Schema inspection and query rewriting can help eliminate these full table scans.