postgres-indexes

Create and optimize PostgreSQL indexes with SQL commands for performance tuning.

8|2|Updated Jan 15, 2026
One-click install
npx skills add https://github.com/bradtaylorsf/alphaagent-team --skill postgres-indexes
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: postgres-indexes
Source: https://github.com/bradtaylorsf/alphaagent-team/tree/main/plugins/aai-stack-postgres/skills/postgres-indexes
Command: npx skills add https://github.com/bradtaylorsf/alphaagent-team --skill postgres-indexes

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers and database administrators create, optimize, and maintain efficient indexes for PostgreSQL databases, leading to faster query performance and reduced resource consumption.

Core Features & Use Cases

  • Index Type Guidance: Provides SQL examples for various index types (B-tree, Hash, GIN, GiST, BRIN) and their optimal use cases.
  • Advanced Indexing: Demonstrates partial, expression, and covering indexes for specific query needs.
  • Maintenance & Analysis: Offers SQL queries to analyze index usage, detect duplicates, identify bloat, and perform concurrent operations.
  • Use Case: A developer needs to speed up slow SELECT queries on a large orders table. This Skill provides the exact SQL commands to create appropriate indexes (e.g., on user_id and created_at) and analyze the query plan to confirm the improvement.

Quick Start

Use the postgres-indexes skill to generate a B-tree index on the 'email' column of the 'users' table.

Frequently Asked Questions about postgres-indexes

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

FAQPage Schema
How do I optimize PostgreSQL indexes for slow query performance?

To optimize PostgreSQL indexes for slow queries, you can create targeted indexes using provided SQL commands, analyze query plans, and implement B-tree, partial, or covering indexes to significantly reduce resource consumption and speed up data retrieval.

What PostgreSQL index type should I use for my specific query needs?

Choosing the right PostgreSQL index type depends on your data and queries. Use B-tree for standard sorting, Hash for equality checks, GIN for full-text search, GiST for geometric data, and BRIN for large tables with naturally ordered data to maximize performance.

When should I use partial or expression indexes in PostgreSQL?

You should use partial or expression indexes in PostgreSQL when you frequently query a specific subset of rows or need to index the result of a function, reducing index size and improving lookup speed for those targeted query patterns.

How do I analyze PostgreSQL index usage and detect bloat?

You can analyze PostgreSQL index usage and detect bloat by running specific maintenance SQL queries provided by the skill, which identify duplicate indexes, reveal unused indexes, and help you perform concurrent operations for ongoing performance tuning.

Can I speed up large SELECT queries on a PostgreSQL table without locking it?

Yes, you can speed up large SELECT queries on a PostgreSQL table by creating appropriate indexes, such as a B-tree index on filtering columns, and using concurrent index operations to avoid locking the table during maintenance and optimization.

What are the limitations of adding indexes to a PostgreSQL database?

The primary limitation of adding indexes to a PostgreSQL database is the increased storage requirement and slower write performance for INSERT and UPDATE operations, making it crucial to analyze index usage and remove unused or duplicate indexes regularly.