I was wondering if a new index and consequentially its creation might benefit from an existing index. It is something just out of curiosity but extremely helpful in the case when you have to create a combined index where the first column already has one.
I give you an example:
- I have a database table with those columns customer_id, department.
- I have an index on the customer_id column
- I need a new combined index customer_id-department
Given the combined index customer_id-department will cover the existing one I can delete the customer_id_index. Is it better to first remove it and then create the new one or given the fact the new one it is a combined one with an existing index it might benefit from it?
Then create the new combined one and after that delete the single index?