logoalt Hacker News

sgarlandtoday at 12:19 AM1 replyview on HN

Unless they’ve been elided, there were no indices other than the PK on any table, and no additional statistics. There are correlated columns here: a given country may have produced more movies in a given range of years, as its movie industry built up; a given country may produce more TV series than movies, etc.

Nearly every time I’ve seen someone resorting to hints for a query, it’s because their statistics are incorrect. Adding hints is papering over the problem, and can backfire later if the data shape changes.


Replies

jval43today at 6:22 AM

>Nearly every time I’ve seen someone resorting to hints for a query, it’s because their statistics are incorrect. Adding hints is papering over the problem, and can backfire later if the data shape changes.

YES. And hints ossify and at some point become useless or even wrong - at least that is my experience analyzing old Oracle queries.

But many people don't want to hear it because they just want a quick fix. Not having hints in PG has been a godsend for longterm quality at $dayjob, because people are forced to think.