whereDate is quietly skipping your index
· 6 min read
Laravel's whereDate wraps the column in a date cast, so Postgres can't use its index on a timestamp column. Measured on a million rows, the half-open range that replaces it is 25 times faster, and the test that guards it has a trap of its own.