sql-query-assistant

Optimize and debug SQL queries using EXPLAIN plans across PostgreSQL, MySQL, SQL Server, and SQLite.

44|9|Updated May 7, 2026
One-click install
npx skills add https://github.com/Omar-Obando/qwen-orchestrator --skill sql-query-assistant
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sql-query-assistant
Source: https://github.com/Omar-Obando/qwen-orchestrator/tree/main/skills/sql-query-assistant
Command: npx skills add https://github.com/Omar-Obando/qwen-orchestrator --skill sql-query-assistant

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It helps you write faster, more reliable SQL queries and fix performance or correctness issues when queries are slow, inefficient, or hard to reason about.

Core Features & Use Cases

  • Query optimization guidance: EXPLAIN-driven diagnosis, indexing strategy, and performance tuning patterns to reduce runtime.
  • Robust query pattern recommendations: JOIN vs subquery tradeoffs, CTEs, window functions, pagination, aggregates, and recursive queries.
  • Database-agnostic plus engine-specific tips: Supports common best practices across PostgreSQL, MySQL, SQL Server, and SQLite with targeted advice.

Quick Start

Use the sql-query-assistant skill to optimize and debug the SQL query: provide the query text, intended results, database type, and what “slow” means (e.g., typical runtime and tables involved).

Frequently Asked Questions about sql-query-assistant

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

FAQPage Schema
How do I optimize slow SQL queries using EXPLAIN analysis?

To optimize slow SQL queries, use EXPLAIN-based debugging to identify inefficient execution plan issues, then apply indexing strategies and best-practice tuning patterns to reduce runtime. This involves reviewing execution plan bottlenecks and adjusting query structures accordingly.

What is the best way to debug complex SQL queries with CTEs and window functions?

Debugging complex SQL queries with CTEs and window functions requires identifying inefficient query patterns and execution plan issues. The process provides best-practice guidance for multi-step SQL, recommending robust patterns for JOINs, subqueries, pagination, and recursive queries.

Does this SQL optimization approach work with PostgreSQL, MySQL, SQL Server, and SQLite?

Yes, this SQL optimization approach supports PostgreSQL, MySQL, SQL Server, and SQLite. It provides database-agnostic best practices alongside targeted, engine-specific optimization considerations and parameterization rules tailored to each database platform's execution plan behavior.

When should I use a JOIN vs a subquery for database performance?

Deciding between a JOIN vs a subquery for database performance depends on execution plan analysis and specific workload requirements. The approach evaluates query pattern tradeoffs, recommending the most efficient structure based on EXPLAIN output and indexing strategy to minimize runtime.

Why does my SQL query run slowly on large reporting tables?

Your SQL query runs slowly on large reporting tables due to inefficient query patterns, missing indexing strategies, or execution plan issues. Enterprise reporting and analytics workloads require EXPLAIN-driven diagnosis to identify bottlenecks and apply performance tuning patterns for data retrieval.

How do I fix SQL query patterns that cause poor database performance?

To fix SQL query patterns causing poor database performance, identify inefficient structures through EXPLAIN analysis and apply recommended patterns for JOINs, CTEs, window functions, and pagination. Parameterization rules and database-appropriate indexing strategies further resolve execution plan issues.