News for hackers. Stuff that matters.
Re:What's new in the Postgres 16 query planner (a.k.a. optim... by sa46 on Friday February 09, 2024 @02:15AM (#39312274)
Related discussion

Why PostgreSQL doesn't have query hints

https://news.ycombinator.com/item?id=2179433 (60 comments, 2011)

The official stance from the Postgres wiki https://wiki.postgresql.org/wiki/OptimizerHintsDiscussion:

> We are not interested in implementing hints in the exact ways they are commonly implemented on other databases.

> Problems with existing Hint systems: Poor application code maintainability, Interference with upgrades, Encouraging bad DBA habits, Does not scale with data size

I don't fault their stance, but it's frustrating when Postgres picks a stupid plan and can't be convinced to do something reasonable.

Re:What's new in the Postgres 16 query planner (a.k.a. optim... by s08148692 on Friday February 09, 2024 @06:53AM (#39313885)
> when Postgres picks a stupid plan and can't be convinced to do something reasonable.

In my experience it can always be convinced to make a reasonable plan, but it's not always trivial. Sometimes it's just adding an index, sometimes it's entirely rewriting a query

Re:What's new in the Postgres 16 query planner (a.k.a. optim... by CubsFan1060 on Friday February 09, 2024 @07:51AM (#39314300)
Agreed. I've found this setting to be difficult: https://postgresqlco.nf/doc/en/param/default_statistics_targ...

Too low == bad query plan. Oddly, too high == bad query plan.

Re:What's new in the Postgres 16 query planner (a.k.a. optim... by Izkata on Friday February 09, 2024 @11:32AM (#39316587)
There's also "the query plan you want won't do what you expect, so I'm giving you the next best thing until you tell me the right way to store the data": https://news.ycombinator.com/item?id=39311536