Re: pg_plan_advice: add NO_ scan and join method tags

From: "Jonathan Gonzalez V(dot)" <jonathan(dot)abdiel(at)gmail(dot)com>
To: Florin Irion <irionr(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, robertmhaas(at)gmail(dot)com
Subject: Re: pg_plan_advice: add NO_ scan and join method tags
Date: 2026-07-14 12:19:32
Message-ID: 87qzl5pxuz.fsf@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hello!

> Hello,
>
> The attached patch adds negative scan- and join-method advice to
> pg_plan_advice. These tags are the complement of the existing
> positive ones:

I was trying to measure the test coverage of this patch and I found that
the meson configuration wasn't updated, I think you're missing something
like this:

--- a/contrib/pg_plan_advice/meson.build
+++ b/contrib/pg_plan_advice/meson.build
@@ -57,6 +57,8 @@ tests += {
'gather',
'join_order',
'join_strategy',
+ 'no_join',
+ 'no_scan',
'partitionwise',
'prepared',
'scan',

After the tests run only two cases were not tested NO_MERGE_JOIN and
NO_NESTED_LOOP, but these supposed to be tested, well I'll dig more on
this one a second pass of the review.

During the check, this came to my attention:

+ case PGPA_TAG_NO_INDEX_ONLY_SCAN:
+ return PGS_INDEXONLYSCAN | PGS_CONSIDER_INDEXONLY;

Reading the comments I got this:

When PGS_CONSIDER_INDEXONLY is
unset, we don't even consider index-only scans, and any such scans that
would have been generated become index scans instead. On the other hand,
unsetting PGS_INDEXSCAN or PGS_INDEXONLYSCAN causes generated paths of the
corresponding types to be marked as disabled.

The message is a bit confusing but, I think that
`PGS_INDEXONLY` should be the only option here? Otherwise, my
understanding is that it will disable also PGS_INDEXSCAN, which is in
the next line to be disable.

Regards,
--
Jonathan Gonzalez V.
EDB
https://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2026-07-14 12:20:47 Re: Row pattern recognition
Previous Message Mahendra Singh Thalor 2026-07-14 12:19:09 Re: pg_restore --format= option(without any value) should report an error as pg_dump is reporting an error