Skip to main content

index-optimizer

Database indexing optimization expert. Identifies missing, redundant, and unused indexes, and provides optimization recommendations. Trigger when user mentions index optimization, query performance, or database tuning.

来源信息

仓库
huifer/CloudSaver
最近来源活动
2026年6月13日 07:45
检测到的 SKILL.md 语言
英语
星标
2
Forks
0

安装方式

默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。

检查来源文件

决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。

文件资源管理器
11 个文件

正在显示 SKILL.md

SKILL.md
来源说明 · 只读预览
name
index-optimizer
description
Database indexing optimization expert. Identifies missing, redundant, and unused indexes, and provides optimization recommendations. Trigger when user mentions index optimization, query performance, or database tuning.
when_to_use
- User asks about index strategy - User needs to optimize query performance - User encounters slow queries - User wants to reduce database costs - User needs to audit index usage
allowed-tools
Bash(psql *, wrangler *)
# Database Index Optimization Expert ## Index Types | Type | Use Case | Trade-off | |------|----------|-----------| | Single Column | Simple equality/range | Low overhead | | Composite | Multi-column queries | Column order matters | | Partial | Subset of rows | Smaller, faster | | Covering | Index-only scans | Larger, eliminates lookups | ## Common Anti-Patterns | Anti-Pattern | Problem | Reference | |--------------|---------|-----------| | Missing composite index | Multi-column queries slow | `references/composite-index.md` | | Missing covering index | Table lookups required | `references/covering-index.md` | | Missing partial index | Indexing all rows | `references/partial-index.md` | | Unused indexes | Write overhead | `references/unused-index.md` | | Redundant indexes | Duplicate coverage | `references/redundant-index.md` | | Index skip scan | Wrong column order | `references/index-skip-scan.md` | ## Audit Workflow ### Step 1: Identify Missing Indexes Check sequential scans and slow queries. See `references/composite-index.md` for multi-column patterns. ### Step 2: Check Redundant Indexes Find indexes that are subsets of other indexes. See `references/redundant-index.md` for detection. ### Step 3: Detect Unused Indexes Monitor index usage statistics. See `references/unused-index.md` for detection and removal. ### Step 4: Optimize Index Design Apply appropriate index type based on query patterns: - Multi-column WHERE → `references/composite-index.md` - Subset queries → `references/partial-index.md` - SELECT-heavy → `references/covering-index.md` ## Benchmark Reference | Optimization | Before | After | Improvement | |--------------|--------|-------|-------------| | Composite index | 500ms | 5ms | 99% | | Partial index | 50MB | 5MB | 90% size reduction | | Covering index | 50ms | 10ms | 80% faster | | Remove unused | 100ms write | 70ms write | 30% faster | | Remove redundant | 200MB | 100MB | 50% reduction | ## Output Format ``` ## Index Optimization Report ### 1. Current State - Total indexes: X - Missing indexes: X - Redundant indexes: X - Unused indexes: X ### 2. Anti-Patterns Detected | Table | Anti-Pattern | Reference | Fix | |-------|--------------|-----------|-----| | ... | ... | ... | ... | ### 3. Recommendations (by priority) 1. [P0] Fix: <anti-pattern> → Expected improvement: XX% Reference: references/<file>.md ### 4. Implementation Apply fixes from referenced files. ```
在 GitHub 查看