• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 209
  • Last Modified:

Primary Key and Index Key in SQL 2005

When I make a field a primary key does it automatically make it an index also?
If I do a lot of searching on UserId and I make it a primary key should I also make it an Index Column?
0
mattphung
Asked:
mattphung
  • 2
1 Solution
 
derekkrommCommented:
yes, if there is no clustered index on the table when you assign the PK, it auto-assigned the PK as a clustered index
0
 
mattphungAuthor Commented:
thanks derek-
--->If I do a lot of searching on UserId and I make it a primary key should I also make it an Index Column?
but do I still need to make it an Index Column?

Also, what's a clustered index? What types of indexes are there?
0
 
derekkrommCommented:
There are clustered and non-clustered indexes. There can only be 1 clustered index on a table. That determines the order in which the records are physically stored in the table.

In your case, since userid is your PK, you don't need to create any additional indexes on it.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now