optimize-queries

Analyze EXPLAIN ANALYZE outputs and optimize Supabase PostgreSQL queries.

1|Updated Oct 19, 2025
One-click install
npx skills add https://github.com/rdimascio/supabase-marketplace --skill optimize-queries
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: optimize-queries
Source: https://github.com/rdimascio/supabase-marketplace/tree/main/plugins/database-operations/.claude/skills/optimize-queries
Command: npx skills add https://github.com/rdimascio/supabase-marketplace --skill optimize-queries

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill automatically analyzes slow queries and recommends concrete optimizations such as indexing, RLS policy improvements, and query restructuring to improve performance.

Core Features & Use Cases

  • Plan Analysis: Analyze EXPLAIN ANALYZE outputs to identify bottlenecks.
  • Index Recommendations: Propose and implement targeted indexes.
  • Policy & Query Restructuring: Improve query patterns and RLS usage.
  • Use Case: Improve a slow posts query by adding a compound index and adjusting policy.

Quick Start

Run analysis on a slow query and implement recommended indexes and policy improvements.

Frequently Asked Questions about optimize-queries

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I optimize slow Supabase PostgreSQL queries?

Query optimization analyzes EXPLAIN ANALYZE output to identify bottlenecks, then applies targeted fixes like indexing, RLS policy improvements, and query restructuring. This Skill automates the analysis and recommends concrete optimizations to improve performance across development, staging, and production environments.

What indexing strategies work best for PostgreSQL performance?

Index recommendations identify which columns or compound indexes eliminate sequential scans and reduce query cost. This Skill proposes targeted indexes based on EXPLAIN ANALYZE output, creates migration scripts, and verifies performance gains using index usage metrics.

Can I improve RLS policies while optimizing query performance?

Row-level security policies can impact query execution plans. This Skill analyzes policy structure alongside query patterns, recommends restructuring to maintain security while reducing overhead, and tests changes across environments before production deployment.

How do I measure query optimization improvements?

Performance measurement compares EXPLAIN ANALYZE metrics and index usage before and after optimization. This Skill executes queries, captures execution plans, and reports quantified improvements to verify that recommended changes actually reduce query cost.

Do I need to manually test optimizations before production deployment?

This Skill handles testing automatically across development, staging, and production environments. It creates migration scripts, validates changes against current workloads, and measures performance impact before committing optimizations to production.

Related Skills