From aj-geddes-useful-ai-prompts-4
Designs and implements database indexing strategies for PostgreSQL and MySQL, covering index types, composite indexes, and performance optimization.
How this skill is triggered — by the user, by Claude, or both
Slash command
/aj-geddes-useful-ai-prompts-4:database-indexing-strategyThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
- [Overview](#overview)
Design comprehensive indexing strategies to improve query performance, reduce lock contention, and maintain data integrity. Covers index types, design patterns, and maintenance procedures.
B-tree Indexes (Default):
-- Standard equality and range queries
CREATE INDEX idx_users_email ON users(email);
CREATE INDEX idx_orders_created_at ON orders(created_at DESC);
-- Composite indexes for multi-column queries
CREATE INDEX idx_orders_user_status
ON orders(user_id, status)
WHERE cancelled_at IS NULL;
Detailed implementations in the references/ directory:
| Guide | Contents |
|---|---|
| PostgreSQL Index Types | PostgreSQL Index Types |
| MySQL Index Types | MySQL Index Types |
| Single Column Indexes | Single Column Indexes, Composite Indexes, Partial/Filtered Indexes, Expression Indexes |
npx claudepluginhub joshuarweaver/cascade-code-languages-misc-1 --plugin aj-geddes-useful-ai-prompts-4B-tree indexes, composite indexes, covering indexes, UNIQUE indexes, and index trade-offs.
Analyzes PostgreSQL and MySQL index usage to detect missing indexes causing sequential scans, unused indexes, and recommend optimal configurations for query performance.
Guides schema design, migration writing, and query optimization with PostgreSQL as primary target. Useful for designing tables, writing up/down migrations, adding indexes, or optimizing slow SQL.