An automated loop designed to systematically identify and resolve database performance bottlenecks to reduce query response times. This agent analyzes execution plans, optimizes slow queries, and applies indexing strategies while maintaining data integrity and safety.
Reduce database query response times to meet or exceed performance targets
Execute the kickoff prompt in your coding environment to begin the automated database optimization process
Set Up Environment
Ensure access to database logs and performance monitoring tools
Run Kickoff Prompt
Paste the provided kickoff prompt into Cursor, Claude Code, Codex, OpenCode, or Gemini CLI
Monitor Iterations
Review agent suggestions each iteration and approve/deny changes as needed
Verify Exit Condition
Confirm latency benchmark meets target upon loop completion
Analyze Current Performance
Extract slow query logs and execution statistics to identify top latency contributors
Identify Bottlenecks
Examine query execution plans, missing indexes, and inefficient joins for each slow query
Performance
Iteratively reduces JavaScript bundle size by analyzing dependencies, identifying large modules, and applying targeted optimizations until a specified size target is met.
Performance
Automatically improves frontend page speed by iteratively analyzing Lighthouse reports and applying targeted optimizations. This loop runs until your target Lighthouse performance score is achieved.
Performance
This loop identifies and optimizes slow API endpoints by continuously benchmarking, analyzing performance bottlenecks, and applying targeted improvements until response times meet predefined budgets.
Propose Optimizations
Suggest improvements including index creation, query refactoring, and schema adjustments
Implement Changes
Apply non-destructive optimizations first, followed by schema or index modifications with safeguards
Run Benchmark
Execute the 'latency benchmark' command to measure improvement against baseline
Evaluate Results
Compare current latency against target; continue loop if under threshold or proceed to next iteration if not
Start the "Database Latency Reducer" loop. Goal: Reduce database query response times to meet or exceed performance targets Max iterations: 10 Between iterations run: latency benchmark Exit when: Average query latency drops below the target threshold Analyze the current database queries for performance bottlenecks. Execute the 'latency benchmark' command to establish a baseline. For the top 3 slowest queries, generate optimized versions and suggest index additions. Implement one change at a time and re-run benchmarks after each modification until average response time meets the target threshold. Self-pace this loop. After each iteration, run `latency benchmark` and evaluate the output, and only continue if the exit condition is not met (Average query latency drops below the target threshold). Stop when the exit condition passes or 10 iterations are reached. Give a short status update each pass.