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.
| Author |
Topic |
|
Blastrix
Posting Yak Master
208 Posts |
Posted - 2003-01-21 : 02:12:07
|
| I have a slight dilemma. After looking at BOL a bit, it seems to indicate that a clustered index should occur on a) columns which have many diverse values. b) columns that are frequently searched for ranges. I have a table that tracks classified ads in which each ad is identified by an integer(AdID, this is the current primary key), so here I have an example of choice 'a'. I also have a column which records the date and time the ad was placed(AdPlaced), and is very frequently searched using range queries. So my question is, which of these two columns is more deserving of the clustered index, since there can only be one? I don't want to make the AdPlaced column part of the primary key. Should I make the AdID column part of the AdPlaced index, give it the clustered constraint, as well as having it be the primary key?Thanks,Steve |
|
|
rihardh
Constraint Violating Yak Guru
307 Posts |
Posted - 2003-01-21 : 02:28:05
|
| The clustered index is not a constraint, it's just a way records are physically ordered in a table. A clustered index should always be on a column which is often (or always) used to search or iterate through records.The index tuning wizard for example, always looks for such columns and decides what kind of index to put on a specific column.Don't counfuse primary keys with indexes, those things are completely different. |
 |
|
|
|
|
|