Given a table (id, col1, col2), does it make sense to create the following indexes:
Index1 (col1) not unique
Index2 (col1, col2) not unique
I am faced with a legacy database that is full of those.
Can I safely delete Index1? Anwser needed for SQL Server and Oracle.
yes, you can delete index 1, if you have
Index2 (col1, col2), there is no need forIndex1 (col1), drop theIndex1 (col1)If the query were to only need the
Index1 (col1), then the use ofIndex2 (col1, col2)will have a slight extra overhead because of the extra column, that is minimal to the maintenance and expense of a complete extra index.That said, if this legacy database is running fine, why make any changes?