agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Robert Haas <rhaas@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: pg_plan_advice: Handle non-repeatable TABLESAMPLE scans.
Date: Mon, 13 Apr 2026 12:46:53 +0000
Message-ID: <E1wCGgn-000mxv-0N@gemulon.postgresql.org> (raw)

pg_plan_advice: Handle non-repeatable TABLESAMPLE scans.

When a tablesample routine says that it is not repeatable across
scans, set_tablesample_rel_pathlist will (usually) materialize it,
confusing pg_plan_advice's plan walker machinery. To fix, update that
machinery to view such Material paths as essentially an extension of
the underlying scan.

Reported-by: Alexander Lakhin <exclusion@gmail.com>
Discussion: http://postgr.es/m/CA+TgmobOOmmXSJz3e+cjTY-bA1+W0dqVDqzxUBEvGtW62whYGg@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3311ccc3d24bf83fb26a8af81ea68a8fcc295c26

Modified Files
--------------
contrib/pg_plan_advice/Makefile          |  2 ++
contrib/pg_plan_advice/expected/scan.out | 38 ++++++++++++++++++++++++++++++++
contrib/pg_plan_advice/pgpa_join.c       | 12 ++++++----
contrib/pg_plan_advice/pgpa_scan.c       | 11 +++++++++
contrib/pg_plan_advice/pgpa_walker.c     | 29 ++++++++++++++++++++++++
contrib/pg_plan_advice/pgpa_walker.h     |  1 +
contrib/pg_plan_advice/sql/scan.sql      | 12 ++++++++++
7 files changed, 101 insertions(+), 4 deletions(-)



Message-ID: <E1wCGgn-000mxv-0N@gemulon.postgresql.org>
Permalink:  ../E1wCGgn-000mxv-0N@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1wCGgn-000mxv-0N@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: pg_plan_advice: Handle non-repeatable TABLESAMPLE scans.
  In-Reply-To: <E1wCGgn-000mxv-0N@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 agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox