Re: On disable_cost

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alena Rybakina <a(dot)rybakina(at)postgrespro(dot)ru>, David Rowley <dgrowleyml(at)gmail(dot)com>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Peter Geoghegan <pg(at)bowt(dot)ie>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: On disable_cost
Date: 2024-10-08 17:04:29
Message-ID: CA+TgmobZ9UZT4N-9rWHi2UevthAztqz+3jYYZHY7wFBUmSj3QQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Oct 7, 2024 at 6:41 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> I don't buy your argument that this case is so special that it
> warrants preserving disable_cost. I certainly didn't think it
> was special when I added it.

That's fair. I'm telling you what I think, not what you have to think. :-)

> There may be another way to do this that doesn't rely on disabling
> the path in the same way as the user-accessible knobs do, but
> I don't really believe it's worth the trouble to think of one.
> And I definitely don't want to keep disable_cost around even for
> just one usage, because then we've not fixed the user-experience
> aspect of this (that is, "why does this plan have a ridiculously high
> cost?"), nor have we fixed all the concerns you had about higher-level
> planning decisions being skewed by that cost.

We don't represent the memory usage of a plan in general, so the
uses-too-much-memory case has to be represented in some other way,
either incrementing disabled nodes or adding something to the cost.
Neither is wholly accurate, in my view. We either conflate too much
memory usage with "runs for a long time" or with "the user said not to
do it".

What I'm actually worried about here is that getting rid of this last
use of disable_cost will interact badly with the work I've proposed
over on the "allowing extensions to control planner behavior" thread.
While the exact details of what we do there have yet to be finalized,
the concept definitely revolves around extensions having a way to
disable certain paths. If an extension gets to control the disabled
nodes knob and the planner gets to control the cost knob, the
extension can be certain of being able to choose the outcome it wants
out of those that are possible. If the core planner also fiddles with
the disabled nodes knob, that is no longer certain. I don't want
extensions to have to invent some weird hack to work around that case,
and I'm sure neither of us wants to have a third thing in core that is
an even-higher-order component of the cost than disabled_nodes.

> One other point here is that if disable_cost remains exposed as a
> global variable (as it is in HEAD), there is no reason to expect
> that any extensions that are using it will get on board with the
> new approach.

Yes, I think if we keep this one use of disable_cost we should rename
it to something like too_much_memory_cost or whatever.

--
Robert Haas
EDB: http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nazir Bilal Yavuz 2024-10-08 17:30:23 Re: Refactoring postmaster's code to cleanup after child exit
Previous Message Andres Freund 2024-10-08 17:00:44 Re: overflow bug for inhcounts