Quantcast
Channel: Forum SQL Server Database Engine
Viewing all articles
Browse latest Browse all 15889

Creating one or more indexes on composite primary key?

$
0
0

So I have this new table, and I want to create a compound primary key on.  

How do I handle the index with this situation ?

The table will typically be queried with a join to it with a condition that includes all 4 columns (or a where clause that includes all 4)

Should I include multiple indexes?

Products
=======
id (identity)
columna
columnb
columnc
columnd

So my key would be something like this

 CONSTRAINT [PK_products] PRIMARY KEY CLUSTERED 
(
[columna] ASC,
[columnb] ASC,
[columnc] ASC,
[columnd] ASC,
)


Viewing all articles
Browse latest Browse all 15889

Trending Articles