Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Help needed on Indexes and Primary Keys

Author  Topic 

brkonthru
Starting Member

31 Posts

Posted - 2003-02-18 : 19:55:28
Hello everyone,

I am using SQL2K and was wondering if having a Clustered Primary Key on and ID field in a table makes it unnecessary to add another index for that same ID field.

I know when I create a uniqe index on a field, it doesnt make it a Primary Key, but is making a field Primary Key removes the need to add an index to it?

Thanks,

robvolk
Most Valuable Yak

15732 Posts

Posted - 2003-02-18 : 20:01:53
That's correct. A primary key constraint is by definition unique, and SQL Server will create an index to enforce it. Any other indexes on the key column would be redundant. The only exception would be if you have a multi-column primary key. Indexing the 2nd, 3rd etc. columns might be beneficial if those columns are frequently JOINed to columns in other tables, or are part of the WHERE clause in popular queries.

Go to Top of Page

brkonthru
Starting Member

31 Posts

Posted - 2003-02-19 : 10:04:00
Thats the answer im looking for.

Thank You.

Go to Top of Page
   

- Advertisement -