whereHas / doesntHave queries, and on MySQL with large child tables they are a classic cause of p95 latency spikes and dashboard timeouts.EXPLAIN output on the top 5 slowest list endpoints. If the bottleneck is a missing index or an unindexed join column, this package buys you nothing and you should spend the sprint elsewhere.with()), and it does not help on Postgres, where the planner generally handles EXISTS semi-joins well. Set expectations accordingly so it doesn't get pitched internally as a general performance fix.Consider it when:
EXPLAIN shows dependent/correlated subqueries for existing whereHas / doesntHave filters on large child tables.EXPLAIN, not vibes.whereHasIn rewrites query semantics; edge cases around soft-deleted children, custom relation keys, polymorphic relations, and mixing with orWhere need regression coverage. That test work is the real adoption cost, not the install.Look elsewhere when:
IN (subquery) can be slower than a semi-join in that regime; MySQL version and data distribution matter. Never adopt this as a blanket rule.For executives — one paragraph: "This is a small, free, open-source performance patch for a specific class of slow database queries behind our admin and reporting screens. It is not a customer-facing feature and should not be funded as a project. The recommendation is to spend one engineering day benchmarking it against our five slowest list endpoints; if it produces a meaningful latency improvement, we reimplement the technique in-house (about a day of work) rather than depend on a package that hasn't been updated since 2021. Expected outcome: lower p95 on reporting screens and fewer 'the dashboard is timing out' tickets, at effectively zero licensing cost. If benchmarking shows no win, we spend that day on indexes instead."
For engineering:
where exists (select …) into where id in (select …), which lets MySQL use semi-join strategies instead of re-evaluating a correlated subquery per row.orWhere combinations, and own it.EXPLAIN before/after and p50/p95 timings on staging with production-scale row counts. If the gain is under ~20% on any query, drop it.How can I help you explore Laravel packages today?