Re: pg_plan_advice: add NO_ scan and join method tags

From: Neil Chen <carpenter(dot)nail(dot)cz(at)gmail(dot)com>
To: Florin Irion <irionr(at)gmail(dot)com>
Cc: song yanli <songyanlili(at)outlook(dot)com>, "Jonathan Gonzalez V(dot)" <jonathan(dot)abdiel(at)gmail(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, "robertmhaas(at)gmail(dot)com" <robertmhaas(at)gmail(dot)com>
Subject: Re: pg_plan_advice: add NO_ scan and join method tags
Date: 2026-07-30 09:33:30
Message-ID: CAA3qoJkrYFnK=skUAtH4J5Y3OTju7wFR8VV2E+5T9P-fRXC05w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Florin,

On Thu, Jul 30, 2026 at 4:55 PM Florin Irion <irionr(at)gmail(dot)com> wrote:

> Hi,
>
> Thank you for reviewing,all confirmed, and fixed in v4.
>
> 1. False conflict via PGS_CONSIDER_INDEXONLY: that's an enforcement
> detail, not a scan method. Added pgpa_scan_semantic_mask(), which strips
> PGS_CONSIDER_INDEXONLY before comparing tags for conflict purposes.
> BITMAP_HEAP_SCAN(t) NO_INDEX_ONLY_SCAN(t) now comes back clean, no
> conflict.
>
> 2. Conflict cancelling unrelated NO_ tags: Replaced the single
> all-or-nothing scan_pos_neg_conflict/jm_pos_neg_conflict gate with
> per-tag conflict tracking. Each NO_ tag is now checked independently;
> only the ones that actually clash get marked conflicting and skipped,
> everything else still gets enforced. Verified with your examples —
> NO_BITMAP_HEAP_SCAN and NO_HASH_JOIN(d) now apply despite an unrelated
> conflict on a different method.
>
> 3. Also caught while testing: index-selection side effect on conflict.
> Separately, found that the "enforce choice of index" block only checked
> !scan_pos_conflict, not !scan_pos_neg_conflict. So INDEX_SCAN(t idx)
> NO_INDEX_SCAN(t) — a genuine conflict, correctly left unenforced at the
> mask level — was still silently disabling every other index on t,
> steering the plan toward idx anyway. Fixed by adding the missing check.

Thanks for v4. I've tested it and everything looks correct -- all three
issues
fixed, and the index-selection side effect is handled nicely too. +1 from
me.

Regards,
--
Ze Chen (Neil)
HighGo Software Co., Ltd.
https://www.highgo.com/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nikita Malakhov 2026-07-30 09:47:20 Re: Direct Toast PoC
Previous Message Amit Kapila 2026-07-30 09:00:46 Re: Fix "unexpected logical decoding status change" error; from concurrent logical decoding activation