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
 General SQL Server Forums
 Database Design and Application Architecture
 Multi Column Index

Author  Topic 

X-Factor
Constraint Violating Yak Guru

392 Posts

Posted - 2008-04-22 : 06:47:01
Hi there,

My 'where' clause contains the following...

startdate <= @Date AND enddate > @Date


Should I put one index on 'startDate' and another on 'endDate' or should I have one index that covers both columns?

I don't know what the difference would be.

Cheers, XF.

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-04-22 : 06:51:56
If you are using both the columns in the WHERE clause, then creating single index or two separate indexes would be equivalent. In case you use either of column in search condition, then order of columns in single composite index matters.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page
   

- Advertisement -