I have run a script that shows SQL suggested indexes which will increase performance greatly. A few of the indexes have the same keys but different INCLUDE columns. Would it be wise to create two indexes or should I combine the INCLUDE columns into one index? What would be the pros/cons of each approach? CREATE INDEX [IDX__COLA__COLB] ON [dbo].[TableA] (COLA],[COLB]) INCLUDE ([COLC], [COLD]) on [PRIMARY] CREATE INDEX [IDX__COLA__COLB] ON [dbo].[TableA] (COLA],[COLB]) INCLUDE ([COLE], [COLF]) on [PRIMARY]
Given that the index key is the same, I would combine the two. Include columns are only stored at the leaf level of the index so you minimize the amount of space required so adding in the additional two columns shouldn't be that large of a hit. Plus by combining them, you'll have a single index that will potentially cover more than one query. I would, however, ensure that the index is indeed being used by the queries. Hope that helps!