db-advisor

Provide PostgreSQL optimization patterns for query tuning, schema design, and indexing.

1|Updated Feb 23, 2026
One-click install
npx skills add https://github.com/kangnam7654/ai-config-sync --skill db-advisor
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: db-advisor
Source: https://github.com/kangnam7654/ai-config-sync/tree/main/claude-code/skills/db-advisor
Command: npx skills add https://github.com/kangnam7654/ai-config-sync --skill db-advisor

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps optimize PostgreSQL database performance by providing best practices for query optimization, schema design, indexing, and security.

Core Features & Use Cases

  • Index Recommendations: Suggests appropriate index types (B-tree, GIN, BRIN) based on query patterns.
  • Data Type Guidance: Recommends optimal data types for various use cases (IDs, strings, timestamps, money, flags).
  • Pattern Examples: Demonstrates effective SQL patterns for composite indexes, covering indexes, partial indexes, Row Level Security (RLS), UPSERT, cursor pagination, and queue processing.
  • Anti-Pattern Detection: Provides SQL queries to identify unindexed foreign keys, slow queries, and table bloat.
  • Configuration Template: Offers a template for essential PostgreSQL configuration settings.

Quick Start

Use the db-advisor skill to get recommendations for optimizing a slow PostgreSQL query.

Frequently Asked Questions about db-advisor

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

FAQPage Schema
How do I optimize a slow PostgreSQL query?

To optimize a slow PostgreSQL query, apply indexing strategies like B-tree, GIN, or BRIN indexes based on your query patterns, and use SQL anti-pattern detection queries to identify unindexed foreign keys and table bloat.

What is the best way to design a PostgreSQL schema for performance?

The best way to design a PostgreSQL schema for performance is to select optimal data types for IDs, strings, timestamps, and flags, while implementing composite, covering, or partial indexes for efficient data retrieval.

Does this database optimization guidance work with Supabase?

Yes, this database optimization guidance works with Supabase, offering specific best practices for Supabase operations including Row Level Security (RLS) policy implementation and efficient PostgreSQL configurations.

When should I use partial indexes versus composite indexes in PostgreSQL?

Use partial indexes in PostgreSQL to index only rows meeting specific conditions for smaller index sizes, and use composite indexes when queries filter on multiple columns simultaneously to optimize complex query patterns.

Why does my PostgreSQL database have unindexed foreign keys causing slow queries?

Your PostgreSQL database has slow queries due to unindexed foreign keys, an anti-pattern detectable via specific SQL queries that identify missing indexes and table bloat, which can be resolved by applying appropriate index recommendations.

How do I configure essential PostgreSQL settings for performance?

To configure essential PostgreSQL settings for performance, apply a configuration template that establishes baseline operational parameters, ensuring efficient database operations and query execution across your environment.