← Back to Skills

SQL Query Optimizer

Analyzes and optimizes SQL queries for maximum performance, covering execution plan interpretation, indexing strategies (B-tree/GIN/GiST), window functions, CTEs, materialized views, partitioning, and PostgreSQL-specific optimization techniques.

Platinum
v1.0.10 activationsData & AnalyticsTechnologyexpert

SupaScore

85
Research Quality (15%)
8
Prompt Engineering (25%)
8.5
Practical Utility (15%)
9
Completeness (10%)
8.5
User Satisfaction (20%)
8.5
Decision Usefulness (15%)
8.5

Best for

  • Fixing slow-running PostgreSQL queries that take seconds instead of milliseconds
  • Analyzing EXPLAIN ANALYZE output to identify performance bottlenecks
  • Designing composite B-tree indexes for multi-column WHERE clauses
  • Optimizing window function queries that process millions of rows
  • Implementing GIN indexes for JSONB and full-text search performance

What you'll get

  • Rewritten query with optimized JOIN order, composite index recommendation (col1, col2, col3), and explanation of why B-tree beats GIN for this access pattern
  • EXPLAIN ANALYZE breakdown showing the expensive node, suggested partial index with WHERE clause, and expected 10x performance improvement
  • Window function optimization using RANGE vs ROWS, covering index design, and materialized view strategy for recurring analytical queries
Not designed for ↓
  • ×Writing SQL queries from scratch (focuses on optimization, not query creation)
  • ×Database schema design or normalization decisions
  • ×Non-PostgreSQL databases like MySQL or SQL Server optimization
  • ×General database administration tasks like backups or user management
Expects

Slow SQL query with execution context (table sizes, frequency, latency requirements) and EXPLAIN ANALYZE output when available.

Returns

Optimized query with specific indexing recommendations, execution plan analysis, and performance improvement rationale.

Evidence Policy

Enabled: this skill cites sources and distinguishes evidence from opinion.

sqlpostgresqlquery-optimizationindexingexecution-plansexplain-analyzewindow-functionsmaterialized-viewspartitioningdatabase-performanceb-treegin-index

Research Foundation: 7 sources (3 official docs, 2 books, 1 industry frameworks, 1 web)

This skill was developed through independent research and synthesis. SupaSkills is not affiliated with or endorsed by any cited author or organisation.

Version History

v1.0.12/15/2026

Auto-versioned: masterfile quality gate passed (score: 85.5)

v1.0.02/14/2026

Initial release

Works well with

Need more depth?

Specialist skills that go deeper in areas this skill touches.

Common Workflows

Database Performance Optimization Pipeline

Systematic approach to optimizing database performance: first optimize individual queries, then design comprehensive indexing strategy, finally tune overall database configuration and monitoring.

Activate this skill in Claude Code

Sign up for free to access the full system prompt via REST API or MCP.

Start Free to Activate This Skill

© 2026 Kill The Dragon GmbH. This skill and its system prompt are protected by copyright. Unauthorised redistribution is prohibited. Terms of Service · Legal Notice