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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-07-02 : 11:04:29
|
| GIRISH writes "I NEED TO CREATE CLUSTERED INDEX ON FOUR COLUMNS,WHAT SHOULD BE THE CRITERIA IN SELECTING SEQUENCE OF COLUMNS WHILE CREATING CLUSTER INDEX?" |
|
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2002-07-02 : 11:18:15
|
| 4 column clustered index? WowWell from what I understand, the order that you use them in the where clause should be the order that you have them in your indexExampleWhere UserID = @UserIDAND UserName = @UserNameand Password = @PasswordYou clustered index should have UserID, UserName and Password in that order.Michael<Yoda>Use the Search page you must. Find answer you will. |
 |
|
|
izaltsman
A custom title
1139 Posts |
Posted - 2002-07-02 : 11:51:21
|
| I will try to develop Michael's thought a bit further. First of all, like he said, you need to consider the queries that you are going to run against this table. Will you always have all 4 fields in the WHERE clause or are you going to have queries filtering on less than 4 columns? If you have queries that filter on less than 4 cols, you need to make sure that the columns they filter on are in the beginning of the index (otherwise this index will not be used by the query).Another thing you need to consider, is selectivity of each field. You should try to place your more selective fields before the less selective ones in your index.Edited by - izaltsman on 07/02/2002 11:51:53 |
 |
|
|
|
|
|