Re: Disallow redundant indexes

From: Sami Imseih <samimseih(at)gmail(dot)com>
To: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
Cc: Japin Li <japinli(at)hotmail(dot)com>, Greg Sabino Mullane <htamfids(at)gmail(dot)com>, David Rowley <dgrowleyml(at)gmail(dot)com>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Disallow redundant indexes
Date: 2025-04-28 18:12:18
Message-ID: CAA5RZ0uT66vWt8ndJtV47LRKnc6kp1TzcF9Pe=pQ8JhUqj6kJg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> > > I've had this idea before, and even wrote a quick POC at one point, but I had it simply throw a warning rather than an
> > > error. That avoids the need for any GUC, which I agree is not a good idea. And it still allows people to create a
> > > duplicate index if they really want to.
> > >
> >
> > I also appreciate your suggestion regarding the GUC parameter. You've
> > convinced me that a warning might be a more appropriate approach. A warning
> > would still alert users to the potential issue of creating a redundant index,
> > while allowing them to proceed if they have a specific reason to do so.

> +1 to a warning.

If I had a dollar for every time I asked a user to check for duplicate
indexes :) So
I think it's a good idea to provide some way to detect these ( besides
a query in the
Wiki ), but I don't think we should prevent it.

While a WARNING will be a good to have, it could easily go unnoticed,
but it's still good to have.

I also think we should either provide a psql shortcut to detect these indexes or
to add annotation to an index in the \d <table> command, or perhaps both of
these things.

--
Sami Imseih
Amazon Web Services (AWS)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2025-04-28 18:23:35 Re: Fix slot synchronization with two_phase decoding enabled
Previous Message Masahiko Sawada 2025-04-28 18:07:20 Re: Parallel heap vacuum