PHP N+1 Query Detector
Identifies and fixes inefficient N+1 database query patterns in PHP applications to optimize performance.
This skill analyzes PHP source code to detect the 'N+1 query problem,' where an application makes excessive database calls within loops instead of using eager loading. It scans for common performance bottlenecks in popular ORMs like Laravel Eloquent and Doctrine, identifying patterns such as lazy loading abuse, nested relationship traversal, and unoptimized aggregation. By providing automated detection, severity classification, and specific refactoring suggestions, it helps developers reduce database latency and improve overall system scalability.
主な機能
01Detects missing eager loading in Laravel Eloquent and Doctrine ORM
02Analyzes nested relationship traversal that causes exponential query growth
03Provides automated code fixes with 'Before' and 'After' query count comparisons
04Identifies database repository and model queries inside foreach/for loops
05Spots external API calls within loops that require batching
0645 GitHub stars
ユースケース
01Optimizing high-traffic API endpoints that suffer from slow database response times
02Refactoring legacy PHP codebases to implement Eager Loading and Batching
03Automating performance audits during code reviews to prevent database bottlenecks