setting for maximum acceptable plan cost? - Mailing list pgsql-general

From Jeffrey W. Baker
Subject setting for maximum acceptable plan cost?
Date
Msg-id 1194036567.11267.19.camel@squeak
Whole thread Raw
Responses Re: setting for maximum acceptable plan cost?
Re: setting for maximum acceptable plan cost?
List 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


pgsql-general by date:

Previous
From: andy
Date:
Subject: Re: Populating large DB from Perl script
Next
From: "Joshua D. Drake"
Date:
Subject: Re: setting for maximum acceptable plan cost?