There are about 300 million rows with unique keys.
There are about 750,000 with unique <date_, id> fields.
The optimizer definitely looks at more...
"if you have 2 indexes with same columns, SQL Server tries to choose the clustered index because its less expensive..."
Thanks! Well, that looks...
Thanks. A few comments.
First: it's inconsistent. If I execute "update statistics", SOMETIMES it uses the correct index; sometimes it does not....
A straightforward approach is to use a subquery:
select * from table t1
t1.signal = 0
and (select count(t2.signal) from table t2 where t2.id =...
I have a table, call it T, with primary key:
id int, date_ smalldatetime, f1 decimal(5,2), f2 smallint
T is clustered on: date_, id, f1, f2
Separate names with a comma.