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 |
|
y0zh
Yak Posting Veteran
60 Posts |
Posted - 2010-04-24 : 08:33:42
|
| [code]IDNAME CITY DATEB COL PRICE VAL DAT_INS12253141 DAA 4/13/2007 200 447.22 F 4/13/07 5:06 AM12253141 DAA 4/13/2007 200 447.22 F 4/13/07 5:07 AM12253141 DAA 4/15/2007 160 447.22 T 4/13/07 8:06 AM12253141 DAA 4/13/2007 200 447.22 F 4/13/07 5:08 AM12253141 DSA 4/13/2007 180 525.14 F 4/13/07 5:06 AM12253141 DSA 4/13/2007 250 626.18 F 4/13/07 5:06 AM[/code]what column will you chose for clustered index and what column you will chose for nonclustered index in this table? |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-04-24 : 08:35:43
|
| i would choose (IDNAME, CITY,DAT_INS) as clusteredNonclustered choice depends on what columns you would mostly using in queries for searching------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
y0zh
Yak Posting Veteran
60 Posts |
Posted - 2010-04-24 : 08:55:54
|
| Great :)I've got the same answer) |
 |
|
|
slimt_slimt
Aged Yak Warrior
746 Posts |
Posted - 2010-04-24 : 09:08:09
|
| i would restructe the table or create a composite table; preferably integer type or have identity on the table and put clustered index on identity.for nonclustered and covered indexes you should look at the table and your application/queries what will be run against the table and based on these plans, prepare nonclustered indexes. |
 |
|
|
GilaMonster
Master Smack Fu Yak Hacker
4507 Posts |
Posted - 2010-04-24 : 09:56:54
|
| I wouldn't personally use a composite clustered index. Without having any further insight into the table (such as the data types), I'd probably chose DAT_INS as the clustered index key. It's narrow (fairly narrow), it's unchanging, it's ever-increasing and it'll probably be almost unique. http://www.sqlservercentral.com/articles/Indexing/68563/As for what columns would be used for the nonclustered, impossible to answer with what you've posted. Indexes are chosen based on the queries that will run against the table. Without seeing the queries, there's no way to select a good nonclustered index.--Gail ShawSQL Server MVP |
 |
|
|
|
|
|