logoalt Hacker News

simmschitoday at 8:06 AM2 repliesview on HN

FINALLY!

I never understood the issues PG had with hints. Running a non-trivial DB with a non-trivial schema and scale is, well, non-trivial at all. At some point the DB stops being a black box and starts being a tool that you have to know inside and out to avoid performance issues.

>The optimizer is usually smarter than you think.

Except for when it isn't, and moves heavy calculation inside a nested loop inside a nested loop to avoid an index scan. Nothing is perfect.


Replies

williamdclttoday at 8:59 AM

> > The optimizer is usually smarter than you think.

> Except for when it isn't, and moves heavy calculation inside a nested loop inside a nested loop to avoid an index scan. Nothing is perfect.

Yeah that's also been my experience. It's true that Postgres is usually smarter than I think, when I try to figure out why it's not using a better query plan I eventually find out that it wouldn't be better at all. But from time to time, it genuinely is taking a bad decision and having no power over that at all is a problem

skywhoppertoday at 10:25 AM

Yeah, this article explains the reasons why, and how this solution avoids them.