Can I create indexes on multiple columns in SQL Server 2012?

I heard that indexes are good, can I create a clustered index on multiple columns or create a clustered index on only one column in SQL Server 2012?

Thank you in advance

+3


source to share


2 answers


Composite Index: You can create an index on multiple columns, but up to 16 columns can be combined into one composite index key. All columns in a composite index key must be in the same table or view. The maximum size for combined index values ​​is 900 bytes.



0


source


You can create a composite clustered index that contains multiple columns in your index. But it will affect insert / update performance.

A simple clustered index would be like

PRIMARY KEY CLUSTERED ([Col1] ASC, [Col2] ASC, [COL3] ASC)

      



This means that datarows are stored as -

Col1    Col2     Col3
1        1        1
1        1        2
1        2        3
2        5        2
2        6        5
3        2        1
3        5        2

      

0


source







All Articles