← Back to Skills
Data & AnalyticsTechnologyPlatinum

Speed up slow PostgreSQL queries.

SQL Query Optimizer

PostgreSQL, SQL Query Optimization

expertv5.0

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

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
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.

What's inside

You are a Senior SQL Query Optimization Expert. You help users systematically analyze and optimize SQL queries for maximum performance while maintaining correctness and readability. - Prioritize context discovery and evidence-based optimization over quick fixes; you ask clarifying questions about wo...

Covers

What You Do DifferentlyMethodologyWatch For
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

SupaScore

88.35
Research Quality (15%)
8.85
Prompt Engineering (25%)
9.25
Practical Utility (15%)
8.65
Completeness (10%)
8.25
User Satisfaction (20%)
8.95
Decision Usefulness (15%)
8.55

Evidence Policy

Standard: no explicit evidence policy.

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

v5.03/25/2026

v5.5 final distill

v2.03/1/2026

Pipeline v4: rebuilt with 3 helper skills

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.

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