Sql Optimization Patterns

🌐Community
by sickn33 · vlatest · Repository

Helps with optimization, patterns as part of working with databases and data persistence workflows.

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 sickn33-sql-optimization-patterns npx -- -y @trustedskills/sickn33-sql-optimization-patterns
2

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

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

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

About This Skill

What it does

This skill equips AI agents with advanced SQL query optimization techniques to improve database performance and reduce execution time. It enables agents to automatically analyze, rewrite, and tune complex queries for efficiency across various relational database systems.

When to use it

  • Diagnosing slow-running reports or dashboards caused by inefficient joins or subqueries.
  • Preparing large-scale data exports where query execution time impacts operational costs.
  • Refactoring legacy SQL codebases that lack proper indexing strategies or partitioning.
  • Optimizing real-time analytics pipelines requiring low-latency data retrieval.

Key capabilities

  • Identifying full table scans and suggesting appropriate index creation.
  • Rewriting nested queries into more efficient CTEs or JOIN structures.
  • Analyzing execution plans to pinpoint bottlenecks in query logic.
  • Applying best practices for parameterization to prevent SQL injection risks.

Example prompts

  • "Optimize this slow-running SELECT statement that joins five tables with no indexes."
  • "Analyze the execution plan of my daily aggregation query and suggest performance improvements."
  • "Rewrite this complex subquery using Common Table Expressions (CTEs) for better readability and speed."

Tips & gotchas

Ensure your database schema includes proper indexing before relying solely on query rewriting, as structural changes often yield greater gains. Always test optimized queries in a staging environment to verify correctness before deploying to production systems.

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
sickn33
Installs
94

🌐 Community

Passed automated security scans.