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