Re: Disallow redundant indexes

2025-04-28 Thread Nathan Bossart
On Mon, Apr 28, 2025 at 01:12:18PM -0500, Sami Imseih wrote: > 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. > > Whil

Re: Disallow redundant indexes

2025-04-28 Thread Sami Imseih
> > > 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 wan

Re: Disallow redundant indexes

2025-04-28 Thread Corey Huinker
> > > 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. > > > >

Re: Disallow redundant indexes

2025-04-24 Thread Japin Li
Hi, Greg and David Thank you for your feedback. On Thu, 24 Apr 2025 at 08:26, Greg Sabino Mullane wrote: > On Thu, Apr 24, 2025 at 7:31 AM David Rowley wrote: > > On Thu, 24 Apr 2025 at 21:27, Japin Li wrote: > > I propose that PostgreSQL prevent redundant index creation by: > > > In an

Re: Disallow redundant indexes

2025-04-24 Thread Greg Sabino Mullane
On Thu, Apr 24, 2025 at 7:31 AM David Rowley wrote: > On Thu, 24 Apr 2025 at 21:27, Japin Li wrote: > > I propose that PostgreSQL prevent redundant index creation by: > In any case, who are we to define what a duplicate index is? I think this part is easier than you make it sound: everythin

Re: Disallow redundant indexes

2025-04-24 Thread David Rowley
On Thu, 24 Apr 2025 at 21:27, Japin Li wrote: > I propose that PostgreSQL prevent redundant index creation by: > > - Checking for identical existing indexes during CREATE INDEX. > - Failing with an error (like Oracle's ORA-01408) if a duplicate is found. > - Providing a GUC parameter (allow_redund

Disallow redundant indexes

2025-04-24 Thread Japin Li
Hi, hackers Currently, PostgreSQL permits creating multiple indexes on the same columns in the same order for a table, potentially leading to redundant indexes. For example: CREATE INDEX ON t(id); CREATE INDEX ON t(id); While permitted, this leads to: - Increased storage consu