PostgreSQL executes queries using cost-based planner and sometimes fails to choose execution plan of the lowest cost for some types of queries. In such cases, pg_hint_plan helps users to guide the planner to choose the plans they want by putting some instructions - call them hints - in the comments prefixed to the SQL statement body. No need to rewrite statement itself nor change some GUC parameters elsewhere.