Lately I've been refactoring the SQL Server indexes of the products that I have developed for my employer. One of these products is an online dashboard containing multiple user levels.
Each user (on admin level) can create projects that they can then link to users of the user level below. Each project has its own Name
field and also the field AdministratorUserId
to keep track of the project admin. I created a combined non-clustered unique index on these two fields, meaning that project names have to be unique per administrator.
Now here's the catch: I am noticing that I often do a select on AdministratorUserId
only, and not on Name
. According the indexing guidelines, and please correct me if I'm wrong, I am to create a non-clustered index on the field in order to optimize my queries.
My question being - does my existing index on Name
+ AdministratorUserId
already improve my queries or is it advisable to create a separate index besides it? Would there be any downside to AdministratorUserId
being present in two separate indexes?