TLDR · PROGRAMMING, DESIGN & DATA SCIENCE

PG_HINT_PLAN

github.comGitHub repository

Summary from the TLDR newsletter

pg_hint_plan allows developers to tweak PostgreSQL execution plans using hints in SQL comments. Planners estimate the costs of each possible execution plan for a SQL statement then execute the plan with the lowest cost. While PostgreSQL's planner does its best to select the best execution plan using its cost-based optimizer, which uses data statistics rather than static rules, it is far from perfect as it doesn't count some data properties. pg_hint_plan has hints to control scan methods, join methods, join order, behavior on join, row number correction, parallel query configuration, and more.