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 |
|
markross
Starting Member
4 Posts |
Posted - 2008-08-25 : 06:01:14
|
| I have a table, this is the most important table, has about 20 columns and 11000 rows.3 columns in particular, ID,JobID,LineNumber.ID is a primary, clusterd, autoincrmenting columnJobID & LineNumber and int's but I created an unique non-clustered index on the combination of these two columns. (Linenumber is unique per JobID).1. Does this index provide me a performance gain or does it only provide a unique constraint?2. Should I make it clustered as retrieving records by JobID, ordered by JobNumber is the most common call and this is where I want my speed?ThanksMark |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-25 : 06:06:33
|
| 1. Depends on how your queries are written and how it uses the two columns.2. cant created it clustered index as you already have one. A table can have only one clustered index. |
 |
|
|
markross
Starting Member
4 Posts |
Posted - 2008-08-25 : 06:14:36
|
| ThanksNormal I will SELECT * FROM tbl WHERE JobID=@JobID ORDERBY LineNumberthis is the important one. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-25 : 07:25:47
|
| Then create a nonclustered index on JobID |
 |
|
|
markross
Starting Member
4 Posts |
Posted - 2008-08-25 : 08:53:18
|
| Done, Thanks |
 |
|
|
|
|
|