Re: On disable_cost
От | Robert Haas |
---|---|
Тема | Re: On disable_cost |
Дата | |
Msg-id | CA+TgmobQmd1mVtFzhM9bK_N+KQ_2YC5yM6cB+zN=nfCYqX0v0g@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: On disable_cost (Greg Sabino Mullane <htamfids@gmail.com>) |
Ответы |
Re: On disable_cost
|
Список | pgsql-hackers |
On Tue, Apr 2, 2024 at 10:04 AM Greg Sabino Mullane <htamfids@gmail.com> wrote: > So rather than listing all the things we don't want to happen, we need a way to force (nay, highly encourage) a particularsolution. As our costing is a based on positive numbers, what if we did something like this in costsize.c? > > Cost disable_cost = 1.0e10; > Cost promotion_cost = 1.0e10; // or higher or lower, depending on how strongly we want to "beat" disable_costseffects. > ... > > if (!enable_seqscan) > startup_cost += disable_cost; > else if (promote_seqscan) > startup_cost -= promotion_cost; // or replace "promote" with "encourage"? I'm pretty sure negative costs are going to create a variety of unpleasant planning artifacts. The large positive costs do, too, which is where this whole discussion started. If I disable (or promote) some particular plan, I want the rest of the plan tree to come out looking as much as possible like what would have happened if the same alternative had won organically on cost. I think the only reason we're driving this off of costing today is that making add_path() more complicated is unappealing, mostly on performance grounds, and if you add disabled-ness (or promoted-ness) as a separate axis of value then add_path() has to know about that on top of everything else. I think the goal here is to come up with a more principled alternative that isn't just based on whacking large numbers into the cost and hoping something good happens ... but it is a whole lot easier to be unhappy with the status quo than it is to come up with something that's actually better. I am planning to spend some more time thinking about it, though. -- Robert Haas EDB: http://www.enterprisedb.com
В списке pgsql-hackers по дате отправления: