postgresql-optimization – skill Viết lách & Nội dung cho agent AI
Quy trình tối ưu cơ sở dữ liệu PostgreSQL: tinh chỉnh truy vấn, chiến lược index, phân tích hiệu năng và quản lý cơ sở dữ liệu production.
Cài skill postgresql-optimization bằng một lệnh
Chọn công cụ bạn đang dùng, copy lệnh và dán vào terminal. Skill sẽ nằm trong thư mục skills của công cụ đó và sẵn sàng dùng ở phiên làm việc tiếp theo.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/postgresql-optimization-f162f.tgz | tar xz -C ~/.claude/skills
Gọi trong Claude Code: /postgresql-optimization – rồi mô tả công việc bạn muốn làm.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/postgresql-optimization-f162f.tgz | tar xz -C ~/.codex/skills
Gọi trong Codex: $postgresql-optimization – rồi mô tả công việc bạn muốn làm.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/postgresql-optimization-f162f.tgz | tar xz -C ~/.hermes/skills
Gọi trong Hermes Agent: /postgresql-optimization – rồi mô tả công việc bạn muốn làm.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/postgresql-optimization-f162f.tgz | tar xz -C ~/.deepcode/skills
Gọi trong DeepSeek: /postgresql-optimization – rồi mô tả công việc bạn muốn làm.
Nội dung SKILL.md
Nội dung SKILL.md gốc bằng tiếng Anh.
PostgreSQL Optimization Workflow
Overview
Specialized workflow for PostgreSQL database optimization including query tuning, indexing strategies, performance analysis, vacuum management, and production database administration.
When to Use This Workflow
Use this workflow when:
- Optimizing slow PostgreSQL queries
- Designing indexing strategies
- Analyzing database performance
- Tuning PostgreSQL configuration
- Managing production databases
Workflow Phases
Phase 1: Performance Assessment
Skills to Invoke
database-optimizer- Database optimizationpostgres-best-practices- PostgreSQL best practices
Actions
1. Check database version
2. Review configuration
3. Analyze slow queries
4. Check resource usage
5. Identify bottlenecks
Copy-Paste Prompts
Use @database-optimizer to assess PostgreSQL performancePhase 2: Query Analysis
Skills to Invoke
sql-optimization-patterns- SQL optimizationpostgres-best-practices- PostgreSQL patterns
Actions
1. Start with EXPLAIN; EXPLAIN ANALYZE executes the statement. Use a representative staging copy for writes or expensive queries, and set appropriate timeouts before an authorized production run.
2. Identify scan types
3. Check join strategies
4. Analyze execution time
5. Find optimization opportunities
Copy-Paste Prompts
Use @sql-optimization-patterns to analyze and optimize queriesPhase 3: Indexing Strategy
Skills to Invoke
database-design- Index designpostgresql- PostgreSQL indexing
Actions
1. Identify missing indexes
2. Create B-tree indexes
3. Add composite indexes
4. Consider partial indexes
5. Review index usage
Copy-Paste Prompts
Use @database-design to design PostgreSQL indexing strategyPhase 4: Query Optimization
Skills to Invoke
sql-optimization-patterns- Query tuningsql-pro- SQL expertise
Actions
1. Rewrite inefficient queries
2. Optimize joins
3. Add CTEs where helpful
4. Implement pagination
5. Test improvements
Copy-Paste Prompts
Use @sql-optimization-patterns to optimize SQL queriesPhase 5: Configuration Tuning
Skills to Invoke
postgres-best-practices- Configurationdatabase-admin- Database administration
Actions
1. Tune shared_buffers
2. Configure work_mem
3. Set effective_cache_size
4. Adjust checkpoint settings
5. Configure autovacuum
Copy-Paste Prompts
Use @postgres-best-practices to tune PostgreSQL configurationPhase 6: Maintenance
Skills to Invoke
database-admin- Database maintenancepostgresql- PostgreSQL maintenance
Actions
1. Schedule VACUUM
2. Run ANALYZE
3. Check table bloat
4. Monitor autovacuum
5. Review statistics
Copy-Paste Prompts
Use @database-admin to schedule PostgreSQL maintenancePhase 7: Monitoring
Skills to Invoke
grafana-dashboards- Monitoring dashboardsprometheus-configuration- Metrics collection
Actions
1. Set up monitoring
2. Create dashboards
3. Configure alerts
4. Track key metrics
5. Review trends
Copy-Paste Prompts
Use @grafana-dashboards to create PostgreSQL monitoringOptimization Checklist
- [ ] Slow queries identified
- [ ] Indexes optimized
- [ ] Configuration tuned
- [ ] Maintenance scheduled
- [ ] Monitoring active
- [ ] Performance improved
Quality Gates
- [ ] Query performance improved
- [ ] Indexes effective
- [ ] Configuration optimized
- [ ] Maintenance automated
- [ ] Monitoring in place
Related Workflow Bundles
database- Database operationscloud-devops- Infrastructureperformance-optimization- Performance
Operational boundaries
Record baseline latency, rows, plan and workload before changing one variable at a time. Index creation and configuration changes can consume disk, take locks or require restart; agree on a maintenance window and rollback first. Prefer routine autovacuum monitoring over indiscriminate manual maintenance; VACUUM FULL rewrites and locks tables. Validate result equivalence as well as latency.
Reference: [PostgreSQL EXPLAIN guidance](https://www.postgresql.org/docs/current/using-explain.html).
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
Skill liên quan
- posthog-automation – Tự động hóa tác vụ PostHog qua Rube MCP (Composio): sự kiện, feature flag, project, hồ…
- postman-collection-generator – Tạo file JSON Postman Collection v2.1 hoàn chỉnh, sẵn sàng import, từ mô tả API bằng…
- postman-newman-automation – Tạo lệnh Newman CLI, file cấu hình, script pipeline Jenkins và shell script tự động để…
- postman-openapi-converter – Chuyển đặc tả OpenAPI 3.x hoặc Swagger 2.0 (YAML hoặc JSON) thành file JSON Postman…
- postmark-automation – Tự động hóa gửi email qua Postmark bằng Rube MCP (Composio): gửi email theo template…
- postmortem-writing – Hướng dẫn toàn diện viết postmortem không đổ lỗi, hiệu quả, giúp tổ chức học hỏi và ngăn…
- pr-writer – Tạo pull request theo thực hành kỹ thuật của Sentry.
- premium-3d-website – Hướng dẫn xây dựng website 3D cao cấp, tập trung vào shader WebGL tùy chỉnh…