2

Possible Duplicate:
Difference of create Index by using include column or not using

Edit: IGNORE THIS POST, I flagged it for a mod as it's a duplicate. Thanks all for the replies!

Creating multi-column indexes, what's the difference between these two:

CREATE INDEX MyIndex ON TABLE1 (COLUMN1 ASC, COLUMN2 ASC, COLUMN3 ASC, [etc...])

vs.

CREATE INDEX MyIndex ON TABLE1 (COLUMN1 ASC)
INCLUDE (COLUMN2, COLUMN3, [etc...] )

MSDN says that the latter means including nonkey columns. What does this mean in layman's terms? Point being, I'm basically dealing with a situation where I have to optimize queries that only need data from 3-5 columns out of dozens within the table, using one of the columns as the "base" index so to speak and getting the other column values from the same row.

Creating a clustered index on the one is not an option as the table is updated regularly, which tends to create a lot of locks and waits. I'm currently testing these out but I'd like an informed answer from you guys too. :)

Community
  • 1
  • 1
Kahn
  • 1,630
  • 1
  • 13
  • 23

1 Answers1

3

It means the index isn't based on the columns in the INCLUDE clause, which means that when a column in the INCLUDE clause is updated, the corresponding row within the index doesn't have to be moved. For details, including usage scenarios, see this

ssis_ssiSucks
  • 1,476
  • 1
  • 12
  • 11