I hate the fact that in Postgres I cannot give the query planner any hints about what indexes it should be using. It’s such a… paternalistic view of “we always know better”. Do I think I always know more than the query planner? Not at all and in 99% of the cases I would just leave it alone (and I have - I think I used index hint maybe twice out of hundreds of pure SQL production queries that I have written). But do I conversely believe that no one ever knows more than the query planner? Hell no. But here’s the really nasty part about it all: no one can prove that they know more (or prove to themselves that they know less) without forking Postgres, implementing index hints and then profiling. And that is obviously a bridge too far.
So YO Postgres developers: want to prove how great your query planner is? Add index hints and allow us to compare.
Last modified on 2024-04-03