Re: pg_*_advice: tsv load failure, etc.

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Dongpo Liu <poe(dot)liu(at)pm(dot)me>
Cc: Jakub Wartak <jakub(dot)wartak(at)enterprisedb(dot)com>, Noah Misch <noah(at)leadboat(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_*_advice: tsv load failure, etc.
Date: 2026-10-09 19:15:14
Message-ID: CA+TgmoZMJFPY=JmebQsqp2wkHaFnHgM5UDEEugKrePJb8n_ucw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Oct 4, 2026 at 8:38 AM Dongpo Liu <poe(dot)liu(at)pm(dot)me> wrote:
> The patch adds a paragraph to the Limitations section of pg_plan_advice
> and a short pointer in pg_stash_advice. It says that advice is consulted
> only at plan time, mentions DISCARD PLANS for the current session, and
> refers to PREPARE for when other sessions re-plan.

I think it's a good idea to add something to the documentation about
this issue, but I'm not entirely convinced by this wording. In
particular:

"The new advice is used the next time the statement is planned" => To
me, this sort of makes it seem like you could just leave
pg_plan_advice.advice set the whole time, which is not a realistic
approach. Or else as though it will remember the advice that it didn't
use this time and use it next time re-planning actually happens, which
it won't.

"Plans cached by other sessions are re-planned only when something
else invalidates them; see <xref linkend="sql-prepare"/>." => I feel
like there are two ways to read this. One possible reading is that
replanning doesn't happen on every use of the cache, but only when
there is a reason to replan. That's just the definition of a cache.
The other possible reading is that invalidation is the only thing that
can trigger replanning, which isn't true;
for example, the other session could have a custom plan, or it could
execute DISCARD PLANS itself.

Here's my rewrite. (Also, I committed my latest round of bug-fix patches.)

--
Robert Haas
Databricks

Attachment Content-Type Size
v2-0001-doc-Note-that-plan-advice-does-not-affect-cached-.patch application/octet-stream 2.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2026-10-09 20:08:25 Re: Bypassing cursors in postgres_fdw to enable parallel plans
Previous Message Kacper Kuras 2026-10-09 19:13:59 Re: Proposal: SELECT * EXCLUDE (...) command