SkillsLib.ai

Sql Query Optimizer

Analyze and rewrite SQL queries for peak database performance

4.5(47 reviews)
500+ downloads
Updated Oct 2026
Verified SafeSecurity VerifiedThis skill was analyzed by our AI security scanner for harmful content including data exfiltration, system manipulation, credential theft, and prompt injection. No threats were detected.

What You Can Do

You can submit any SQL query and receive a thoroughly optimized version with specific performance improvements. The skill analyzes query structure, recommends missing indexes with creation syntax for your database dialect, rewrites inefficient patterns, and provides estimated performance gains. It maintains semantic equivalence while transforming your queries into production-ready code.

Features

Query rewriting

transforms slow patterns into optimized equivalents while preserving logic

Index recommendations

identifies missing indexes with dialect-specific creation syntax

Correlated subquery elimination

converts dependent subqueries into efficient JOINs or window functions

JOIN optimization

restructures multi-table operations for minimal data scanning

CTE refactoring

improves readability and performance using Common Table Expressions

Multi-dialect support

optimizes for PostgreSQL, MySQL, and SQLite with dialect-specific syntax

Performance analysis

provides estimated improvement percentages and explains each optimization

EXPLAIN plan interpretation

analyzes execution plans to identify bottlenecks and sequential scans

Example Output

Input Query:

code
SELECT u.id, u.name, (SELECT COUNT(*) FROM orders WHERE orders.user_id = u.id) as order_count
FROM users u
WHERE u.created_at > '2024-01-01';

Optimized Output:

code
WITH user_orders AS (
  SELECT user_id, COUNT(*) as order_count
  FROM orders
  GROUP BY user_id
)
SELECT u.id, u.name, COALESCE(uo.order_count, 0) as order_count
FROM users u
LEFT JOIN user_orders uo ON u.id = uo.user_id
WHERE u.created_at > '2024-01-01';

Index Recommendation:

code
CREATE INDEX idx_users_created_at ON users(created_at);
CREATE INDEX idx_orders_user_id ON orders(user_id);

Performance Impact: ~65% faster execution time by eliminating correlated subquery (N+1 problem).

What's Included

  • SKILL.md: Complete optimization framework with dialect-specific syntax rules
  • Query optimization checklist: 15-point performance review template
  • Index recommendation template: Structured format for proposing database indexes
  • EXPLAIN plan decoder: Guide to interpreting execution plans across PostgreSQL, MySQL, and SQLite
  • Common anti-patterns guide: Quick reference for slow query patterns and their optimized alternatives

Who It's For

  • Database Administrators — optimizing production queries and capacity planning
  • Backend Engineers — improving application performance and reducing database load
  • Data Engineers — tuning ETL and data pipeline queries for efficiency
  • DevOps Engineers — troubleshooting slow database performance in CI/CD pipelines
  • Performance Specialists — analyzing and benchmarking query optimization efforts

Best For

  • Slow query analysis and rewriting for production systems
  • Index design and recommendation for large datasets
  • Converting legacy SQL patterns to modern, efficient syntax
  • Troubleshooting N+1 query problems and correlated subqueries
  • Preparing queries for high-traffic environments with strict latency requirements

You might also like

Database Performance Tuning Analyzer
$45
Database Performance Tuning Analyzer

You can systematically diagnose database performance bottlenecks by sharing your schema, slow query logs, and execution plans with Claude. It identifies root causes—missing indexes, inefficient joins, lock contention—and provides prioritized recommendations with ready-to-implement SQL. Skip the manual log analysis and get tuning strategies tailored to your workload.

Database Performance Tuning Analyst
$30
Database Performance Tuning Analyst

Use Claude to systematically analyze your database queries, execution plans, and schema to identify performance bottlenecks. The skill generates actionable optimization recommendations with SQL rewrites, index strategies, and configuration tuning. You'll receive detailed before-and-after performance analysis to validate improvements and prioritize work by impact.

IoT Firmware Analysis & Device Debugger
$40
IoT Firmware Analysis & Device Debugger

Rapidly analyze firmware logs and diagnose hardware issues that cause device failures, connectivity problems, and performance degradation. You'll identify root causes from stack traces, crash dumps, and sensor data, then generate specific optimization recommendations. This skill transforms raw device logs into actionable debugging plans that reduce time-to-resolution from hours to minutes.

Injectable Formulation Development & Troubleshooting
$40
Injectable Formulation Development & Troubleshooting

You'll develop systematic approaches to injectable formulation design, from API selection through sterilization strategy. Claude helps you troubleshoot failed batches by analyzing root causes, recommends regulatory pathways (505(b)(2), ANDA, NDA), and provides science-backed solutions for stability, compatibility, and manufacturability challenges.

Mobile Feature Architecture & Implementation
$40
Mobile Feature Architecture & Implementation

You'll design and implement mobile features with architectural rigor, cross-platform considerations, and edge-case handling built-in. This skill generates complete system designs, platform-specific implementation strategies, performance optimization approaches, and testing frameworks. The output is production-ready guidance spanning iOS and Android with security, offline resilience, and deployment strategies included.

Git Commit Message Writer
$45
CI/CD4.3(47)
Git Commit Message Writer

Claude analyzes your code diffs and generates standardized commit messages that follow the Conventional Commits specification. The skill automatically determines the correct commit type, scope, and description based on the changes you've made, ensuring your messages are parseable by automation tools while remaining human-readable for code reviewers.

Structured NLP Analysis and Annotation with Claude
$35
NLP3.3(6)
Structured NLP Analysis and Annotation with Claude

You can transform raw text into structured, labeled datasets for machine learning, analysis, and research. This skill performs named entity recognition, sentiment classification, part-of-speech tagging, and dependency parsing—generating consistent, validated annotations at scale. Use it to prepare corpora, extract entities, classify documents, or perform linguistic analysis without manual annotation.

ROS Control Architecture & Debugging
$30
ROS Control Architecture & Debugging

You can architect multi-node ROS control systems from scratch, including node design patterns, communication flows, and real-time constraints. You'll debug complex node interactions using publisher/subscriber analysis, service call tracing, and action server diagnostics. You can optimize motion controllers through PID tuning, trajectory planning validation, and performance profiling to achieve precise, responsive robotic behavior.

$24.00$30.00