Laravel's `whereDate('created_at', $day)` feels clean, but it secretly wraps the column in `DATE()` which kills the index on big tables.
Swap it for a `>= startOfDay()` / `< next day` range and MySQL can use the index again. Same trap hits `whereMonth`, `whereYear`, `whereDay` if the column is inside a function, assume the index is gone.
dev.to/tegos/laravel-wheredate-silently-kills-your-index-2lnf
Back