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 2000 Forums
 SQL Server Development (2000)
 Can an index help speed up this query?

Author  Topic 

NewMedia42
Starting Member

35 Posts

Posted - 2004-06-07 : 21:38:19
I have a query that is basically this:

SELECT ID, Start, End, AnotherID FROM [Table] WHERE (Start >= Variable1) AND (End <= Variable1) AND (AnotherID != Variable2)

Variable1 and Variable2 change for each query, but would it be helpful (select performance wise) to have an index based on Start,End,AnotherID ?

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2004-06-07 : 22:45:43
It would speed this query up considerably. You do need to make sure the extra writes for the index on inserts and deletes won't outway the benefit of speeding up this one query.

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page
   

- Advertisement -