I'm relatively new to the world of SQL Server Optimization and Indexes. I ran a query that recommends missing indexes (https://blog.sqlauthority.com/2011/01/03/sql-server-2008-missing-index-script-download/) and I'm having trouble understanding the differences of the Include
clause.
The only difference in my two indexes is that Index1
contains the 'Email' column and Index2
does NOT. Would both of these indexes be required or will Index1
be sufficient? I believe only Index1 is needed but I'm not sure.
CREATE INDEX [Index1]
ON [ActiveDirectory].[dbo].[ActiveDirectory] ([MailEnabled], [Active])
INCLUDE ([EmployeeID], [DisplayName], [Email])
CREATE INDEX [Index2]
ON [ActiveDirectory].[dbo].[ActiveDirectory] ([MailEnabled], [Active])
INCLUDE ([EmployeeID], [DisplayName])
Thank you!
Griz