Re: allowing extensions to control planner behavior

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: allowing extensions to control planner behavior
Date: 2024-08-28 20:35:18
Message-ID: CA+TgmoY4yBRawLY-u0GM6aW7f0N4W8RU8WsZRb5+qhpWWfmZcQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Aug 28, 2024 at 4:29 PM Jeff Davis <pgsql(at)j-davis(dot)com> wrote:
> Preserving a path for the right amount of time seems like the primary
> challenge for most of the use cases you raised (removing paths is
> easier than resurrecting one that was pruned too early). If we try to
> keep a path around, that implies that we need to keep parent paths
> around too, which leads to an explosion if we aren't careful.
>
> But we already solved all of that for pathkeys. We keep the paths
> around if there's a reason to (a useful pathkey) and there's not some
> other cheaper path that also satisfies the same reason.

But we've already solved it for this case, too. This is exactly what
incrementing disabled_nodes does. This very recently replaced what we
did previously, which was adding disable_cost to the cost of every
path. Either way, you just need a hook that lets you disable the paths
that you don't prefer. Once you do that, add_path() takes care of the
rest: disabled paths lose to non-disabled paths, and disabled paths
lose to more expensive disabled paths.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2024-08-28 20:47:47 Re: Significant Execution Time Difference Between PG13.14 and PG16.4 for Query on information_schema Tables.
Previous Message Jeff Davis 2024-08-28 20:29:43 Re: allowing extensions to control planner behavior