Re: On disable_cost

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
Cc: Jim Finnerty <jfinnert(at)amazon(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: On disable_cost
Date: 2019-11-02 15:04:58
Message-ID: 30025.1572707098@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com> writes:
> On Fri, Nov 01, 2019 at 09:30:52AM -0700, Jim Finnerty wrote:
>> re: coping with adding disable_cost more than once
>>
>> Another option would be to have a 2-part Cost structure. If disable_cost is
>> ever added to the Cost, then you set a flag recording this. If any plans
>> exist that have no disable_costs added to them, then the planner chooses the
>> minimum cost among those, otherwise you choose the minimum cost path.

> Yeah, I agree having is_disabled flag, and treat all paths with 'true'
> as more expensive than paths with 'false' (and when both paths have the
> same value then actually compare the cost) is probably the way forward.

It would have to be a count, not a boolean --- for example, you want to
prefer a path that uses one disabled SeqScan over a path that uses two.

I'm with Andres in being pretty worried about the extra burden imposed
on add_path comparisons.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Konstantin Knizhnik 2019-11-02 15:09:42 Re: [Proposal] Global temporary tables
Previous Message Tom Lane 2019-11-02 15:00:30 Re: Refactor parse analysis of EXECUTE command