项目文件夹

文件
wehub-resource-sync bb5c75ce05
Component Security Validation / Security Audit (push) Has been cancelled
Deploy to Cloudflare Pages / deploy (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:38:58 +08:00

1 行
3.9 KiB
JSON

{"content": "---\nname: postgresql-optimization\ndescription: \"PostgreSQL database optimization workflow for query tuning, indexing strategies, performance analysis, and production database management.\"\ncategory: granular-workflow-bundle\nrisk: safe\nsource: personal\ndate_added: \"2026-02-27\"\n---\n\n# PostgreSQL Optimization Workflow\n\n## Overview\n\nSpecialized workflow for PostgreSQL database optimization including query tuning, indexing strategies, performance analysis, vacuum management, and production database administration.\n\n## When to Use This Workflow\n\nUse this workflow when:\n- Optimizing slow PostgreSQL queries\n- Designing indexing strategies\n- Analyzing database performance\n- Tuning PostgreSQL configuration\n- Managing production databases\n\n## Workflow Phases\n\n### Phase 1: Performance Assessment\n\n#### Skills to Invoke\n- `database-optimizer` - Database optimization\n- `postgres-best-practices` - PostgreSQL best practices\n\n#### Actions\n1. Check database version\n2. Review configuration\n3. Analyze slow queries\n4. Check resource usage\n5. Identify bottlenecks\n\n#### Copy-Paste Prompts\n```\nUse @database-optimizer to assess PostgreSQL performance\n```\n\n### Phase 2: Query Analysis\n\n#### Skills to Invoke\n- `sql-optimization-patterns` - SQL optimization\n- `postgres-best-practices` - PostgreSQL patterns\n\n#### Actions\n1. Run EXPLAIN ANALYZE\n2. Identify scan types\n3. Check join strategies\n4. Analyze execution time\n5. Find optimization opportunities\n\n#### Copy-Paste Prompts\n```\nUse @sql-optimization-patterns to analyze and optimize queries\n```\n\n### Phase 3: Indexing Strategy\n\n#### Skills to Invoke\n- `database-design` - Index design\n- `postgresql` - PostgreSQL indexing\n\n#### Actions\n1. Identify missing indexes\n2. Create B-tree indexes\n3. Add composite indexes\n4. Consider partial indexes\n5. Review index usage\n\n#### Copy-Paste Prompts\n```\nUse @database-design to design PostgreSQL indexing strategy\n```\n\n### Phase 4: Query Optimization\n\n#### Skills to Invoke\n- `sql-optimization-patterns` - Query tuning\n- `sql-pro` - SQL expertise\n\n#### Actions\n1. Rewrite inefficient queries\n2. Optimize joins\n3. Add CTEs where helpful\n4. Implement pagination\n5. Test improvements\n\n#### Copy-Paste Prompts\n```\nUse @sql-optimization-patterns to optimize SQL queries\n```\n\n### Phase 5: Configuration Tuning\n\n#### Skills to Invoke\n- `postgres-best-practices` - Configuration\n- `database-admin` - Database administration\n\n#### Actions\n1. Tune shared_buffers\n2. Configure work_mem\n3. Set effective_cache_size\n4. Adjust checkpoint settings\n5. Configure autovacuum\n\n#### Copy-Paste Prompts\n```\nUse @postgres-best-practices to tune PostgreSQL configuration\n```\n\n### Phase 6: Maintenance\n\n#### Skills to Invoke\n- `database-admin` - Database maintenance\n- `postgresql` - PostgreSQL maintenance\n\n#### Actions\n1. Schedule VACUUM\n2. Run ANALYZE\n3. Check table bloat\n4. Monitor autovacuum\n5. Review statistics\n\n#### Copy-Paste Prompts\n```\nUse @database-admin to schedule PostgreSQL maintenance\n```\n\n### Phase 7: Monitoring\n\n#### Skills to Invoke\n- `grafana-dashboards` - Monitoring dashboards\n- `prometheus-configuration` - Metrics collection\n\n#### Actions\n1. Set up monitoring\n2. Create dashboards\n3. Configure alerts\n4. Track key metrics\n5. Review trends\n\n#### Copy-Paste Prompts\n```\nUse @grafana-dashboards to create PostgreSQL monitoring\n```\n\n## Optimization Checklist\n\n- [ ] Slow queries identified\n- [ ] Indexes optimized\n- [ ] Configuration tuned\n- [ ] Maintenance scheduled\n- [ ] Monitoring active\n- [ ] Performance improved\n\n## Quality Gates\n\n- [ ] Query performance improved\n- [ ] Indexes effective\n- [ ] Configuration optimized\n- [ ] Maintenance automated\n- [ ] Monitoring in place\n\n## Related Workflow Bundles\n\n- `database` - Database operations\n- `cloud-devops` - Infrastructure\n- `performance-optimization` - Performance\n"}