Every Laravel application has slow queries. The question is whether you find them before your users do. A query that takes 50ms on your local machine with 100 rows might take 5 seconds in production with 500,000 rows. A polymorphic relationship that works fine in development becomes a full table scan when the morphables table hits a million records. An Eloquent scope that chains three whereHas calls generates a nested subquery monster that brings your database server to its knees during peak traffic. The good news: Laravel gives you excellent tools to find these queries before they cause outages. The better news: once you find them, the fixes are usually straightforward. This post walks through a complete workflow β from local detection with Debugbar and Telescope, through query analysis with EXPLAIN, to production monitoring with Deploynix. Step 1: Detect Slow Queries in Development The first line of defense is catching slow queries during development. Two tools make this effortless.β¦