Sql Query Optimizer

🌐Community
by patricio0312rev · vlatest · Repository

Provides querying guidance and assistance for working with databases and data persistence.

Install on your platform

We auto-selected Claude Code based on this skill’s supported platforms.

1

Run in terminal (recommended)

terminal
claude mcp add sql-query-optimizer npx -- -y @trustedskills/sql-query-optimizer
2

Or manually add to ~/.claude/settings.json

~/.claude/settings.json
{
  "mcpServers": {
    "sql-query-optimizer": {
      "command": "npx",
      "args": [
        "-y",
        "@trustedskills/sql-query-optimizer"
      ]
    }
  }
}

Requires Claude Code (claude CLI). Run claude --version to verify your install.

About This Skill

What it does

This skill helps you optimize SQL queries for better performance within your database. It analyzes existing queries and provides suggestions for improvement, including identifying slow operations like full table scans and recommending index creation to speed up data retrieval. The tool uses EXPLAIN ANALYZE output to pinpoint bottlenecks and offer targeted solutions.

When to use it

  • You're experiencing slow query performance in your database application.
  • You want to understand why a specific SQL query is taking a long time to execute.
  • You need assistance identifying missing indexes that could improve query efficiency.
  • You are looking for guidance on how to interpret EXPLAIN ANALYZE output.

Key capabilities

  • Analyzes SQL queries using EXPLAIN ANALYZE.
  • Identifies inefficient operations like sequential scans.
  • Recommends the creation of indexes to improve query performance.
  • Provides example code for creating suggested indexes.

Example prompts

  • "Can you analyze this SQL query and tell me how to make it faster? SELECT u.*, COUNT(o.id) as order_count FROM users u LEFT JOIN orders o ON o.user_id = u.id WHERE u.created_at > '2024-01-01' GROUP BY u.id ORDER BY order_count DESC LIMIT 10;"
  • "I have a slow query: SELECT * FROM orders WHERE user_id = 123. What’s wrong with it?"
  • “What indexes should I add to improve the performance of my database queries?”

Tips & gotchas

  • This skill focuses on providing optimization suggestions based on EXPLAIN ANALYZE output. It does not automatically apply any changes to your database schema.
  • The effectiveness of index recommendations depends heavily on your specific data and query patterns.

Tags

🛡️

TrustedSkills Verification

Unlike other registries that point to live repositories, TrustedSkills pins every skill to a verified commit hash. This protects you from malicious updates — what you install today is exactly what was reviewed and verified.

Security Audits

Gen Agent Trust HubPass
SocketPass
SnykPass

Details

Version
vlatest
License
Author
patricio0312rev
Installs
34

🌐 Community

Passed automated security scans.