setting for maximum acceptable plan cost?

From: "Jeffrey W(dot) Baker" <jwbaker(at)acm(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: setting for maximum acceptable plan cost?
Date: 2007-11-02 20:49:27
Message-ID: 1194036567.11267.19.camel@squeak
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2007-11-02 21:00:58 Re: AutoVacuum Behaviour Question
Previous Message andy 2007-11-02 20:33:20 Re: Populating large DB from Perl script