ANALYZE ➜ rethink predicate ➜ simplify query ➜ audit policies & GUCs ➜
If still wrong, try pg_hint_plan (force an index to prove a point) or hypopg (hypothetical indexes) before filing a bug.
ANALYZE ➜ rethink predicate ➜ simplify query ➜ audit policies & GUCs ➜
If still wrong, try pg_hint_plan (force an index to prove a point) or hypopg (hypothetical indexes) before filing a bug.
2️⃣ Truly un-selective: Stats are right; scan really is cheaper.
3️⃣ Complex estimates: Many joins / ORs / CTE / functions scramble row estimates.
4️⃣ Handcuffs on: RLS limits optimizations or GUCs forbid the path.
5️⃣ Planner bugs: Rare but...
2️⃣ Truly un-selective: Stats are right; scan really is cheaper.
3️⃣ Complex estimates: Many joins / ORs / CTE / functions scramble row estimates.
4️⃣ Handcuffs on: RLS limits optimizations or GUCs forbid the path.
5️⃣ Planner bugs: Rare but...