From: | Japin Li <japinli(at)hotmail(dot)com> |
---|---|
To: | PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Disallow redundant indexes |
Date: | 2025-04-24 09:27:08 |
Message-ID: | ME0P300MB0445159ED0FD67DF4B76A80DB6852@ME0P300MB0445.AUSP300.PROD.OUTLOOK.COM |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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 consumption
- Performance degradation (for data modification)
- Maintenance overhead
- Potential query optimizer confusion
Oracle prevents this with an error like ORA-01408: such column list already
indexed [1].
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_redundant_indexes) to control this.
This change would:
- Prevent accidental redundancy
- Optimize storage
- Improve performance
- Simplify maintenance
- Enhance efficiency and user flexibility
I’d love to hear your feedback or suggestions for improvement.
[1] https://docs.oracle.com/en/error-help/db/ora-01408/?r=19c
--
Regrads,
Japin Li
From | Date | Subject | |
---|---|---|---|
Next Message | Antonin Houska | 2025-04-24 09:33:45 | Re: Conflicting updates of command progress |
Previous Message | Nisha Moond | 2025-04-24 09:24:04 | Re: Fix slot synchronization with two_phase decoding enabled |