I was thinking that it might be nice to be able to tell postgres to
refuse to execute any plan with an estimated cost above some threshold.
For example, earlier today I produced this extremely bogus execution
plan with the following top line:
Nested Loop Left Join (cost=13920.16..2257575559347.46 rows=3691992705807 width=128)
After a call to ANALYZE, the same query gave me:
Merge Left Join (cost=16382.02..16853.87 rows=126768 width=59)
And runs in 5 seconds. If I had been able to tell pg to reject any plan
with cost over, say 10E9, that would have saved my server from half an
hour of nested sequential scans.
Should I just use statement_timeout as a proxy for this?
-jwb