pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robert Haas <rhaas@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Remove grotty use of disable_cost for TID scan plans.
Date: Mon, 22 Jul 2024 19:20:41 +0000
Message-ID: <E1sVyaP-000kXq-6u@gemulon.postgresql.org> (raw)

Remove grotty use of disable_cost for TID scan plans.

Previously, the code charged disable_cost for CurrentOfExpr, and then
subtracted disable_cost from the cost of a TID path that used
CurrentOfExpr as the TID qual, effectively disabling all paths except
that one. Now, we instead suppress generation of the disabled paths
entirely, and generate only the one that the executor will actually
understand.

With this approach, we do not need to rely on disable_cost being
large enough to prevent the wrong path from being chosen, and we
save some CPU cycle by avoiding generating paths that we can't
actually use. In my opinion, the code is also easier to understand
like this.

Patch by me. Review by Heikki Linnakangas.

Discussion: http://postgr.es/m/591b3596-2ea0-4b8e-99c6-fad0ef2801f5@iki.fi

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/e4326fbc60c44aab6df5849d3d67a0cba4c71cf2

Modified Files
--------------
src/backend/optimizer/path/allpaths.c | 14 +++++++++---
src/backend/optimizer/path/costsize.c | 26 ----------------------
src/backend/optimizer/path/tidpath.c  | 41 ++++++++++++++++++++++++++++++-----
src/include/optimizer/paths.h         |  2 +-
4 files changed, 48 insertions(+), 35 deletions(-)



Message-ID: <E1sVyaP-000kXq-6u@gemulon.postgresql.org>
Permalink:  ../E1sVyaP-000kXq-6u@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1sVyaP-000kXq-6u@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: rhaas@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Remove grotty use of disable_cost for TID scan plans.
  In-Reply-To: <E1sVyaP-000kXq-6u@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox