Re: EXPLAIN IndexOnlyScan shows disabled when enable_indexonlyscan=on

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Melanie Plageman <melanieplageman(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>
Subject: Re: EXPLAIN IndexOnlyScan shows disabled when enable_indexonlyscan=on
Date: 2024-10-22 01:32:45
Message-ID: CAApHDvqAY6OVVPSRqGkcPExRKutCGzZPbhWm0EkORWGqLBWVxQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 22 Oct 2024 at 13:45, Melanie Plageman
<melanieplageman(at)gmail(dot)com> wrote:
> I was surprised today when I saw that with
> enable_indexscan=off
> enable_indexonlyscan=on
> EXPLAIN prints that the index only scan is disabled:
>
> QUERY PLAN
> -----------------------------------------------
> Index Only Scan using history_pkey on history
> Disabled: true

There's nothing new about Index Only Scans being disabled by
enable_indexscan. Index Only Scan is chosen with your test case as all
possible Paths are disabled and IOS is the cheapest of all Paths.

The PG17 results for your test case are:

QUERY PLAN
---------------------------------------------------------------------------------------------------------
Index Only Scan using history_pkey on history
(cost=10000000000.29..10000000527.78 rows=19966 width=4)
(1 row)

(note the 1e10 disable_cost has been applied to the Index Only Scan costs)

Robert did propose to change this behaviour while he was working on
the disabled_nodes changes. I did push back on the proposed change
[1]. If you feel strongly that what we have is wrong, then maybe it's
worth opening the discussion about that again.

David

[1] https://www.postgresql.org/message-id/CAApHDvoUUKi0JNv8jtZPfc_JkLs7FqymC5-DDUFNKnm4MMmPuQ%40mail.gmail.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2024-10-22 01:46:23 EXPLAIN IndexOnlyScan shows disabled when enable_indexonlyscan=on
Previous Message Peter Smith 2024-10-22 01:02:58 Re: Pgoutput not capturing the generated columns