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)
 Index

Author  Topic 

shapper
Constraint Violating Yak Guru

450 Posts

Posted - 2009-08-04 : 10:09:03
Hello,

I have the following table:

create table dbo.Errors
(
Id uniqueidentifier rowguidcol not null constraint DF_Errors_Id default (newid()),
Application nvarchar(60) not null,
Host nvarchar(50) not null,
Type nvarchar(100) not null,
Source nvarchar(60) not null,
Message nvarchar(500) not null,
[User] nvarchar(50) not null,
StatusCode int not null,
TimeUtc datetime not null,
[Sequence] int identity (1, 1) not null,
AllXml ntext not null,
constraint PK_Errors primary key nonclustered
)


And then the following:

create nonclustered index IX_Errors_App_Time_Seq on dbo.Errors
(
Application asc,
TimeUtc desc,
[Sequence] desc
)
on [primary]
go


What is this index?
It creates an order rule for when many records are loaded?
Is there a way to incorporate this on the table creation or should really being created apart?

Thanks,
Miguel

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-08-04 : 10:11:33
seems like a covering index created on table
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-08-04 : 10:12:32
it should be created apart and it will make queries making use of these columns faster
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-08-04 : 10:21:36
I assumed a query only can use one index at a time for any table in a query, unless there is a bookmark lookup?


N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page
   

- Advertisement -