On Mon, Aug 26, 2024 at 3:28 PM Robert Haas <robertmh...@gmail.com> wrote:
> Well, I agree that this doesn't address everything you might want to
> do, ... I will very happily propose more things to
> address the other problems that I know about ...

In that vein, here's a new patch set where I've added a second patch
that allows extensions to control choice of index. It's 3 lines of new
code, plus 7 lines of comments and whitespace. Feeling inspired, I
also included a contrib module, initial_vowels_are_evil, to
demonstrate how this can be used by an extension that wants to disable
certain indexes but not others. This is obviously quite silly and we
might (or might not) want a more serious example in contrib, but it
demonstrates how easy this can be with just a tiny bit of core
infrastructure:

robert.haas=# load 'initial_vowels_are_evil';
LOAD
robert.haas=# explain select count(*) from pgbench_accounts;
                                                   QUERY PLAN
-----------------------------------------------------------------------------------------------------------------
 Aggregate  (cost=2854.29..2854.30 rows=1 width=8)
   ->  Index Only Scan using pgbench_accounts_pkey on pgbench_accounts
 (cost=0.29..2604.29 rows=100000 width=0)
(2 rows)
robert.haas=# alter index pgbench_accounts_pkey rename to
evil_pgbench_accounts_pkey;
ALTER INDEX
robert.haas=# explain select count(*) from pgbench_accounts;
                                  QUERY PLAN
------------------------------------------------------------------------------
 Aggregate  (cost=2890.00..2890.01 rows=1 width=8)
   ->  Seq Scan on pgbench_accounts  (cost=0.00..2640.00 rows=100000 width=0)
(2 rows)
robert.haas=#

-- 
Robert Haas
EDB: http://www.enterprisedb.com

Attachment: v2-0002-Allow-extensions-to-mark-an-individual-IndexOptIn.patch
Description: Binary data

Attachment: v2-0001-Convert-enable_-GUCs-into-per-RelOptInfo-values-w.patch
Description: Binary data

Reply via email to