DOCS: pg_plan_advice minor doc fixes
DOCS: pg_plan_advice minor doc fixes
Hi hackers,
I noticed the following minor discrepancy in the pg_plan_advice docs, attached a patch to address this.
(1) FOREIGN SCAN should be FOREIGN JOIN in the scan method advice tag. I tested with FOREIGN SCAN and can confirm it gives a syntax error while the other one works correctly.
postgres=# SET pg_plan_advice.advice = 'FOREIGN_JOIN((t1 t2))';
EXPLAIN (COSTS OFF, PLAN_ADVICE)
SELECT * FROM fdw_t1 t1 JOIN fdw_t2 t2 ON t1.id = t2.t1_id;
SET
QUERY PLAN
-------------------------------------------------
Foreign Scan
Relations: (fdw_t1 t1) INNER JOIN (fdw_t2 t2)
Supplied Plan Advice:
FOREIGN_JOIN((t1 t2)) /* matched */
Generated Plan Advice:
FOREIGN_JOIN((t1 t2))
NO_GATHER(t1 t2)
(7 rows)
EXPLAIN (COSTS OFF, PLAN_ADVICE)
SELECT * FROM fdw_t1 t1 JOIN fdw_t2 t2 ON t1.id = t2.t1_id;
SET
QUERY PLAN
-------------------------------------------------
Foreign Scan
Relations: (fdw_t1 t1) INNER JOIN (fdw_t2 t2)
Supplied Plan Advice:
FOREIGN_JOIN((t1 t2)) /* matched */
Generated Plan Advice:
FOREIGN_JOIN((t1 t2))
NO_GATHER(t1 t2)
(7 rows)
(2) NESTED_LOOP_MEMOIZE is missing from the join method list in the doc though it is supported. Verified this by running below:
postgres=# SET pg_plan_advice.advice = 'NESTED_LOOP_MEMOIZE(d)';
SET
postgres=# EXPLAIN (COSTS OFF, PLAN_ADVICE) select * from t1 f JOIN t2 ON f.id = t2.t1_id;
QUERY PLAN
--------------------------------------------
Hash Join
Hash Cond: (t2.t1_id = f.id)
-> Seq Scan on t2
-> Hash
-> Seq Scan on t1 f
Supplied Plan Advice:
NESTED_LOOP_MEMOIZE(d) /* not matched */
Generated Plan Advice:
JOIN_ORDER(t2 f)
HASH_JOIN(f)
SEQ_SCAN(t2 f)
NO_GATHER(f t2)
(12 rows)
SET
postgres=# EXPLAIN (COSTS OFF, PLAN_ADVICE) select * from t1 f JOIN t2 ON f.id = t2.t1_id;
QUERY PLAN
--------------------------------------------
Hash Join
Hash Cond: (t2.t1_id = f.id)
-> Seq Scan on t2
-> Hash
-> Seq Scan on t1 f
Supplied Plan Advice:
NESTED_LOOP_MEMOIZE(d) /* not matched */
Generated Plan Advice:
JOIN_ORDER(t2 f)
HASH_JOIN(f)
SEQ_SCAN(t2 f)
NO_GATHER(f t2)
(12 rows)
Regards,
Lakshmi
Re: DOCS: pg_plan_advice minor doc fixes
Lakshmi N <lakshmin.jhs@gmail.com> 于2026年4月8日周三 15:09写道:
Hi hackers,I noticed the following minor discrepancy in the pg_plan_advice docs, attached a patch to address this.(1) FOREIGN SCAN should be FOREIGN JOIN in the scan method advice tag. I tested with FOREIGN SCAN and can confirm it gives a syntax error while the other one works correctly.postgres=# SET pg_plan_advice.advice = 'FOREIGN_JOIN((t1 t2))';
EXPLAIN (COSTS OFF, PLAN_ADVICE)
SELECT * FROM fdw_t1 t1 JOIN fdw_t2 t2 ON t1.id = t2.t1_id;
SET
QUERY PLAN
-------------------------------------------------
Foreign Scan
Relations: (fdw_t1 t1) INNER JOIN (fdw_t2 t2)
Supplied Plan Advice:
FOREIGN_JOIN((t1 t2)) /* matched */
Generated Plan Advice:
FOREIGN_JOIN((t1 t2))
NO_GATHER(t1 t2)
(7 rows)(2) NESTED_LOOP_MEMOIZE is missing from the join method list in the doc though it is supported. Verified this by running below:postgres=# SET pg_plan_advice.advice = 'NESTED_LOOP_MEMOIZE(d)';
SET
postgres=# EXPLAIN (COSTS OFF, PLAN_ADVICE) select * from t1 f JOIN t2 ON f.id = t2.t1_id;
QUERY PLAN
--------------------------------------------
Hash Join
Hash Cond: (t2.t1_id = f.id)
-> Seq Scan on t2
-> Hash
-> Seq Scan on t1 f
Supplied Plan Advice:
NESTED_LOOP_MEMOIZE(d) /* not matched */
Generated Plan Advice:
JOIN_ORDER(t2 f)
HASH_JOIN(f)
SEQ_SCAN(t2 f)
NO_GATHER(f t2)
(12 rows)Regards,Lakshmi
I found that this patch is not fully modified and is missing a part:
`Foreign Scan` ---> `Foreign Join`
Best regards,
--
wang jie
Re: DOCS: pg_plan_advice minor doc fixes
От:
Lakshmi N <lakshmin.jhs@gmail.com>
Дата:
Hi Jie,
On Wed, Apr 8, 2026 at 12:52 AM jie wang <jugierwang@gmail.com> wrote:
Lakshmi N <lakshmin.jhs@gmail.com> 于2026年4月8日周三 15:09写道:Hi hackers,I noticed the following minor discrepancy in the pg_plan_advice docs, attached a patch to address this.(1) FOREIGN SCAN should be FOREIGN JOIN in the scan method advice tag. I tested with FOREIGN SCAN and can confirm it gives a syntax error while the other one works correctly.postgres=# SET pg_plan_advice.advice = 'FOREIGN_JOIN((t1 t2))';
EXPLAIN (COSTS OFF, PLAN_ADVICE)
SELECT * FROM fdw_t1 t1 JOIN fdw_t2 t2 ON t1.id = t2.t1_id;
SET
QUERY PLAN
-------------------------------------------------
Foreign Scan
Relations: (fdw_t1 t1) INNER JOIN (fdw_t2 t2)
Supplied Plan Advice:
FOREIGN_JOIN((t1 t2)) /* matched */
Generated Plan Advice:
FOREIGN_JOIN((t1 t2))
NO_GATHER(t1 t2)
(7 rows)(2) NESTED_LOOP_MEMOIZE is missing from the join method list in the doc though it is supported. Verified this by running below:postgres=# SET pg_plan_advice.advice = 'NESTED_LOOP_MEMOIZE(d)';
SET
postgres=# EXPLAIN (COSTS OFF, PLAN_ADVICE) select * from t1 f JOIN t2 ON f.id = t2.t1_id;
QUERY PLAN
--------------------------------------------
Hash Join
Hash Cond: (t2.t1_id = f.id)
-> Seq Scan on t2
-> Hash
-> Seq Scan on t1 f
Supplied Plan Advice:
NESTED_LOOP_MEMOIZE(d) /* not matched */
Generated Plan Advice:
JOIN_ORDER(t2 f)
HASH_JOIN(f)
SEQ_SCAN(t2 f)
NO_GATHER(f t2)
(12 rows)Regards,LakshmiHi,
I found that this patch is not fully modified and is missing a part:
`Foreign Scan` ---> `Foreign Join`
LGTM.
Regards,
Lakshmi
Re: DOCS: pg_plan_advice minor doc fixes
От:
Robert Haas <robertmhaas@gmail.com>
Дата:
On Wed, Apr 8, 2026 at 3:52 AM jie wang wrote: > I found that this patch is not fully modified and is missing a part: > `Foreign Scan` ---> `Foreign Join` I believe you're wrong about this. EXPLAIN shows "Foreign Scan", not "Foreign Join". Committed without this change. -- Robert Haas EDB: http://www.enterprisedb.com