EXPLAIN IndexOnlyScan shows disabled when enable_indexonlyscan=on
Melanie Plageman <melanieplageman@gmail.com>
From: Melanie Plageman <melanieplageman@gmail.com>
To: Pg Hackers <pgsql-hackers@postgresql.org>
Cc: David Rowley <dgrowley@gmail.com>, Robert Haas <robertmhaas@gmail.com>
Date: 2024-10-22T00:45:32Z
Lists: pgsql-hackers
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
I wasn't sure if this was expected -- maybe index-only scan is
considered a type of index scan for this purpose. I dug around this
disable_cost thread [1] a bit to see if I could figure out what the
expected behavior is on my own, but I'm still not sure.
Anyway, maybe I'm misunderstanding something.
Here's my repro:
CREATE TABLE history(
id INT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
data TEXT);
INSERT INTO history(data)
select repeat('a', 100) from generate_series(1,10000)i;
VACUUM history;
set enable_seqscan = off;
set enable_indexscan = off;
set enable_bitmapscan = off;
set enable_indexonlyscan = on;
EXPLAIN (costs off) SELECT id from history;
- Melanie
[1] https://www.postgresql.org/message-id/flat/CA%2BTgmoZEg1tyW31t3jxhvDwff29K%3D2C9r6722SuFb%3D3XVKWkow%40mail.gmail.com#402856db473920b9e0193b9f2cc2739b
Commits
-
Doc: clarify enable_indexscan=off also disabled Index Only Scans
- 857f13f79994 12.21 landed
- ee8db41a9432 13.17 landed
- ca643bcd7a81 14.14 landed
- 75f09cc460a3 15.9 landed
- 4f47ee03d5f8 16.5 landed
- e5086b3ff441 17.1 landed
- dda781609f97 18.0 landed