Re: pg_plan_advice: add NO_ scan and join method tags

From: Dongpo Liu <poe(dot)liu(at)pm(dot)me>
To: Florin Irion <irionr(at)gmail(dot)com>
Cc: Neil Chen <carpenter(dot)nail(dot)cz(at)gmail(dot)com>, 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-12-02 18:33:36
Message-ID: XEZYtjqZUxqzCBdJRrkoVGGGeHApzeLoovjDRydJbNJnqJo-IbwdmfN1oagM--VTSnFmt6xH9EP150hpgwoGZIBKdsbnIYQVFNJoCX_5PhE=@pm.me
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Florin,

I have two questions about v4/v5. Full SQL reproducer
attached.

1. Order-dependent conflict handling

Is this order dependence intended when positive tags already conflict?

A: SEQ_SCAN(t) INDEX_SCAN(t scan_test_pkey) NO_SEQ_SCAN(t)
B: INDEX_SCAN(t scan_test_pkey) SEQ_SCAN(t) NO_SEQ_SCAN(t)

For the same query, the results are:

A: Index Scan; NO_SEQ_SCAN(t) /* matched */
B: Seq Scan; NO_SEQ_SCAN(t) /* matched, conflicting, failed */

Both orders mark the positive tags conflicting, but only B ignores
NO_SEQ_SCAN. The positive/negative check in
pgpa_planner_apply_scan_advice() uses only the last positive scan_type.

2. Failure feedback for an outer target

With enable_nestloop=off, enable_mergejoin=off, and NO_HASH_JOIN(f),
the chosen fallback is:

Nested Loop
Disabled: true
-> Seq Scan on fact f
-> Index Scan using dim_pkey on dim d

Yet the feedback is:

NO_HASH_JOIN(f) /* matched */

NO_HASH_JOIN(f) requires f on the inner side. Should this therefore report
matched, failed? The walker checks the forbidden method, but not the
required inner input.

Regards,
Dongpo Liu

Attachment Content-Type Size
review-pg-plan-advice-repro.sql application/sql 1.3 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2026-12-02 18:35:49 Re: Fix race between copying and dropping a replication slot
Previous Message Tom Lane 2026-12-02 17:18:56 Re: Move src/backend/storage/ipc/ to just src/backend/ipc/