Problem is that index as is. I can't alter or add it.
Can I do something for better query plan?
Index on 2 columns: pid
, Date
.
But select
is only on Date
...
Table deal
is very big (>1 000 000 rows)
create table deal
(
Id Int, NOT NULL PRIMARY KEY NONCLUSTERED,
pid Int, NOT NULL,
Date smalldatetime NOT NULL
)
create clustered index pk ON deal (pid, Date)
select *
from deal
where Date between @d1 and @d2