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 2005 Forums
 Transact-SQL (2005)
 Clustered Index

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 column
JobID & 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?


Thanks

Mark

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.
Go to Top of Page

markross
Starting Member

4 Posts

Posted - 2008-08-25 : 06:14:36
Thanks
Normal I will SELECT * FROM tbl WHERE JobID=@JobID ORDERBY LineNumber
this is the important one.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-08-25 : 07:25:47
Then create a nonclustered index on JobID
Go to Top of Page

markross
Starting Member

4 Posts

Posted - 2008-08-25 : 08:53:18
Done, Thanks
Go to Top of Page
   

- Advertisement -