nunomaduro/laravel-optimize-database
Laravel package by Nuno Maduro that inspects the queries your app actually runs and adds the missing database indexes for you. It records query patterns, then generates migrations to speed up slow lookups, making database optimization largely automatic in Laravel projects.
Adopt when most of the following hold:
Look elsewhere (or treat it as a starting point only) when:
EXPLAIN-driven review are strictly better inputs than convention. This package is a floor, not a ceiling.To executives: This is a small, free, MIT-licensed utility that generates database index migrations for our Laravel app. It is a one-time, low-cost way to reduce the risk of slow pages and database strain at launch and during early growth. It requires no vendor contract, no new infrastructure, and no ongoing subscription; the generated files live in our repository, so there is no lock-in and we can walk away at any time. It is not a scalability strategy on its own — it is the cheapest first step before we consider real investments like caching or read replicas.
To engineering: It publishes a set of opinionated migrations that add indexes on the columns we almost always end up indexing anyway. Treat the output as a reviewed starting point, not as gospel: edit the migrations, confirm driver support, check for lock risk on any large tables, and validate with EXPLAIN on our actual hot queries. It saves the "which columns do we index" discussion and gives us a defensible default; it does not replace slow-query monitoring. Cost of adoption is a day or less; cost of reversal is deleting the migration files.
How can I help you explore Laravel packages today?