Mohamed Haroun | Free Laravel Tools

Laravel N+1 Detector and Query Explainer

Two tabs in one tool: the first finds N+1 in a query log or in your code, the second explains any Eloquent line with the SQL Laravel actually runs.

🔒 The analysis runs inside your browser. Your code is never sent to a server.

What is N+1 anyway?

When you fetch a list of items (say 100 posts) and then, inside a loop, touch a relation on each item ($post->user->name), Laravel runs one query for the posts plus one query per post to fetch its author. That is 101 queries instead of 2. The fix: Post::with('user')->get(), which runs just 2 queries no matter how many posts there are.

This tool is a first-pass check: it compares the shape of queries after masking their values, so if the same query repeats many times it is probably N+1. Final confirmation comes after adding eager loading and comparing the query count.

كاشف N+1 وشارح استعلامات Eloquent مجاني من محمد هارون. ألصق query log أو كود فيه لوب أو سلسلة Eloquent؛ وخد نتائج الاستعلامات المتكررة مع حلول eager loading وSQL تقريبي وعدد الاستعلامات ونصائح الـ indexes. يعمل بالكامل داخل متصفحك.