EXPLAIN ANALYZE on a query the optimizer had improved

A query with a hand-written optimiser hint from 2019, re-examined after an upgrade, where the hint was now choosing the worse plan.

-- with the hint
-> Index scan on orders using idx_status  (cost=41,208)
     (actual time=0.4..1,840 rows=412,884 loops=1)

-- without
-> Filter: (orders.created_at > <cached>)  (cost=8,102)
     (actual time=0.2..88 rows=4,102 loops=1)
     -> Index range scan on orders using idx_created

-- 1.8s → 88ms, by deleting four words.

A hint is a decision frozen at the moment it was written, and it survives every upgrade that would have changed the answer. This one had been correct in 2019 and the histogram added in January made the unhinted plan better — auditing hints after a major version upgrade is fifteen minutes and is not on anybody’s upgrade checklist.