From: | Japin Li <japinli(at)hotmail(dot)com> |
---|---|
To: | Greg Sabino Mullane <htamfids(at)gmail(dot)com> |
Cc: | 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-24 14:20:55 |
Message-ID: | ME0P300MB04453EFD4EF20DDCA36BE7AEB6852@ME0P300MB0445.AUSP300.PROD.OUTLOOK.COM |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi, Greg and David
Thank you for your feedback.
On Thu, 24 Apr 2025 at 08:26, Greg Sabino Mullane <htamfids(at)gmail(dot)com> wrote:
> On Thu, Apr 24, 2025 at 7:31 AM David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
>
> On Thu, 24 Apr 2025 at 21:27, Japin Li <japinli(at)hotmail(dot)com> wrote:
> > I propose that PostgreSQL prevent redundant index creation by:
>
>
> In any case, who are we to define what a duplicate index is?
>
You're absolutely right. Defining a duplicate index is indeed simpler than
I initially described.
> I think this part is easier than you make it sound: everything (except the name) is exactly the same as an existing
> index. That's the 99% case we are trying to catch here.
>
As Greg pointed out, if everything except the name is identical to an existing
index, it should be considered a duplicate in most cases (the 99% case).
This is precisely the scenario I'm aiming to prevent.
> 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.
--
Regrads,
Japin Li
From | Date | Subject | |
---|---|---|---|
Next Message | Andrei Lepikhov | 2025-04-24 14:31:14 | Re: Showing applied extended statistics in explain Part 2 |
Previous Message | Tom Lane | 2025-04-24 14:10:22 | Re: [PATCH] dynahash: add memory allocation failure check |