Pg_hint_plan – Use planner hints on PostgreSQL
github.com
github.com
The author's page about pg_hint_plan: https://pghintplan.osdn.jp/pg_hint_plan.html
Also available in Japanese: https://pghintplan.osdn.jp/pg_hint_plan-ja.html
I can recall a single genuine case where the planner could not make a good plan, and 1000 where a colleague would have created some unmaintainable time bomb; instead they were driven to understand an actual underlying issue that resulted in a more accurate expression of the query.
That one case, as the author says, is PostgreSQL statistics are per-table and do not understand correlation in the data.
How different would the implementation be for the hints to express these correlations instead?
In many cases I see developers thinking they have better plan in mind... only to see it actually results in slower query execution. It is easy to demo for MySQL but not so for PostgreSQL