Indexing on unique columns
Optimize identifies redundant indexing on unique columns and provides recommendations for better database performance.
Why this is an issue
Unique constraints inherently enforce uniqueness by generating an underlying index. Adding an additional index to the same column is unnecessary and can lead to extra overhead.
This redundancy increases write costs and slows down updates, as the database must synchronize multiple indexes.
This guideline applies broadly to relational databases like PostgreSQL, MySQL, MariaDB, SQLite, and SQL Server, which automatically create indexes for unique constraints.