Files
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 line
3.6 KiB
JSON

{"content": "---\nallowed-tools: Read, Bash, Grep, Glob\nargument-hint: [database-type] | --postgresql | --mysql | --mongodb\ndescription: Optimize database queries, indexing, and performance for improved response times and scalability\n---\n\n# Optimize Database Performance\n\nOptimize database queries and performance: **$ARGUMENTS**\n\n## Instructions\n\n1. **Database Performance Analysis**\n - Analyze current database performance and identify bottlenecks\n - Review slow query logs and execution plans\n - Assess database schema design and normalization\n - Evaluate indexing strategy and query patterns\n - Monitor database resource utilization (CPU, memory, I/O)\n\n2. **Query Optimization**\n - Identify and optimize slow-performing queries\n - Analyze query execution plans and optimization strategies\n - Rewrite queries for better performance and efficiency\n - Implement query hints and optimization directives\n - Configure query timeout and resource limits\n\n3. **Index Strategy Optimization**\n - Analyze existing indexes and their usage patterns\n - Design optimal indexing strategy for query patterns\n - Create composite indexes for multi-column queries\n - Implement covering indexes to avoid table lookups\n - Remove unused and redundant indexes\n\n4. **Schema Design Optimization**\n - Optimize table structure and data types\n - Implement denormalization strategies for read-heavy workloads\n - Design partitioning strategies for large tables\n - Create materialized views for complex aggregations\n - Optimize foreign key relationships and constraints\n\n5. **Connection Pool Optimization**\n - Configure optimal database connection pooling settings\n - Tune connection pool size and timeout settings\n - Implement connection monitoring and health checks\n - Optimize connection lifecycle and cleanup procedures\n - Configure connection security and SSL settings\n\n6. **Query Result Caching**\n - Implement intelligent database result caching\n - Design cache invalidation strategies for data consistency\n - Set up query-level and result-set caching\n - Configure cache expiration and refresh policies\n - Monitor cache effectiveness and hit rates\n\n7. **Database Monitoring and Profiling**\n - Set up comprehensive database performance monitoring\n - Monitor query performance and resource usage\n - Track database connections and session activity\n - Implement alerting for performance degradation\n - Configure automated performance reporting\n\n8. **Read Replica and Load Balancing**\n - Configure read replicas for query distribution\n - Implement intelligent read/write query routing\n - Set up load balancing across database instances\n - Monitor replication lag and consistency\n - Configure failover and disaster recovery procedures\n\n9. **Database Vacuum and Maintenance**\n - Implement automated database maintenance procedures\n - Configure vacuum and analyze operations for optimal performance\n - Set up index rebuilding and maintenance schedules\n - Monitor table bloat and fragmentation\n - Implement automated cleanup and archival strategies\n\n10. **Performance Testing and Benchmarking**\n - Set up database performance testing frameworks\n - Implement load testing scenarios for realistic workloads\n - Benchmark query performance under different conditions\n - Test database scalability and capacity limits\n - Monitor performance regression and improvements\n\nFocus on database optimizations that provide the most significant performance improvements for your specific workload patterns. Always measure performance before and after changes to validate optimizations."}