Hacker News new | ask | show | jobs
by mike_hock 1028 days ago
Yes, and Postgres remains staunchly opposed to planner hints because the planner knows better! It always computes the optimal query plan!

The "optimal query plan" changes at the drop of a hat, as you can see in this case. Absolutely trivial syntax changes result in a completely different query, sometimes turning a sequential scan into an index-only scan or vice versa. So, 100x difference in query time, it doesn't just do that for small tables.

1 comments

To add to this, did you know changing the order of your joins can impact the query plan chosen?