aj-geddes avatar

Database Indexing Strategy

A solid reference for when you're adding indexes to PostgreSQL or MySQL and need to think beyond the defaults. Covers the standard index types (B-tree, Hash, GiST, BRIN), composite indexes, and partial indexes with practical SQL examples. The structure is straightforward: guidance on choosing the right index type, patterns for multi-column scenarios, and maintenance considerations. Most useful when you're optimizing slow queries or designing schemas from scratch and want to avoid the classic mistakes like indexing everything or missing compound index opportunities. The reference guides break down database-specific implementations, which saves you from hunting through docs.

skills.sh installs
491
GitHub stars
379
last updated
Aug 21, 2026

Install

$ npx -y skills add aj-geddes/useful-ai-prompts --skill database-indexing-strategy --agent claude-code

Installs into .claude/skills of the current project.

Files

Database Indexing Strategy

Table of Contents

Overview

Design comprehensive indexing strategies to improve query performance, reduce lock contention, and maintain data integrity. Covers index types, design patterns, and maintenance procedures.

When to Use

  • Index creation and planning
  • Query performance optimization through indexing
  • Index type selection (B-tree, Hash, GiST, BRIN)
  • Composite and partial index design
  • Index maintenance and monitoring
  • Storage optimization with indexes
  • Full-text search index design

Quick Start

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;

Reference Guides

Detailed implementations in the references/ directory:

Sponsors

Details

Repository
github.com/aj-geddes/useful-ai-prompts
Categories
Backend & APIs, AI & Agent Building, Debugging, Marketing & SEO, Design & UI/UX, Databases
First seen
Jun 3, 2026

More from aj-geddes/useful-ai-prompts

All 258
1auth0 avatarauth0-aspnetcore-apiauth0/agent-skillsUse when protecting ASP.NET Core Web API endpoints with JWT Bearer token validation, scope checks, or DPoP binding. Integrates Auth0.AspNetCore.Authentication.A490skills.sh installs
2davila7 avatarapi-patternsdavila7/claude-code-templatesAPI design principles and decision-making. REST vs GraphQL vs tRPC selection, response formats, versioning, pagination.486skills.sh installs
3secondsky avatarapi-design-principlessecondsky/claude-skillsMaster REST and GraphQL API design principles to build intuitive, scalable, and maintainable APIs that delight developers. Use when designing new APIs, reviewin479skills.sh installs
4intellectronica avatarupstash-redis-kvintellectronica/agent-skillsRead and write to Upstash Redis-compatible key-value store via REST API. Use when there is a need to save or retrieve key-value data, use Redis features (cachin473skills.sh installs
5secondsky avatarapi-reference-documentationsecondsky/claude-skillsCreates professional API documentation using OpenAPI specifications with endpoints, authentication, and interactive examples. Use when documenting REST APIs, cr465skills.sh installs
6aj-geddes avataraws-rds-databaseaj-geddes/useful-ai-promptsDeploy and manage relational databases using RDS with Multi-AZ, read replicas, backups, and encryption. Use for PostgreSQL, MySQL, MariaDB, and Oracle.453skills.sh installs