In SQL开发者_StackOverflow中文版 Server 2000, is it better to create an index on start
and end
date columns combined or one index on each one? MySQL handles multiple column indexes in a way that would most likley work fine with both columns in a single index. But I'm unsure how SQL Server handles this.
The idea is to search on a record where the enddate > GIVEN_DATE
and also sometimes using startdate < GIVEN_DATE AND enddate > GIVE_DATE
.
Since the table I will be adding the index to is quite large and will take some time and keep our system offline during that time I ask here before so I don't have to redo the procedure later ;)
I'll try to create one INDEX on fields ENDDATE + STARTDATE. In this case MS SQL can use this index in queries
.... where ENDADATE > somedate
and on queries
.... where ENDADATE > somedate and STARTDATE < otherdate
But keep in mind that this index will not be used in queries like
.... where STARTDATE < somedate
精彩评论