sql - Build Best index for this Query -
i have query. query takes time return results. made possible combination of where, funcs(), index. index in table, or similar tables 10 times in space data. if data 1gb, indexex 10gb.
i believe proper index, return result instantly. when same field repeats itself, money7, means same field in search more times.
looking & suggestions.
select top 100 tinyint3, money1, money2, money3, money4, count(date1), (sum(money7) - (sum(smallint1) * moneyconstval)) / count(date1), sum(smallint1), (sum(money7) - (sum(smallint1) * moneyconstval)) / sum(smallint1), sum(money7) - (sum(smallint1) * moneyconstval) colresultname ssum1 with(nolock) day <= '2008-10-31' , profitprotect <= 100 group tinyint3, money1, money2, money3, money4 order colresultname desc, money1, money2 desc, money3 desc, money4
for case try index:
create nonclustered index ix_ssum1_search on ssum1 (day,profitprotect)
usually indexes created columns included in where
Comments
Post a Comment