Take the 2-minute tour ×  I have a relatively large table that
is accessed in exactly one way, by exactly one query (on the
read side).  The query filters the table by two columns (both
bit), and sorts by a third column (an integer). Note that the
query names the columns (it doesn't actually use "*"). The "TOP
1000" is intentional and is part of the production query:  The
query is generated--not sure why it generates the way it does.
MyTable m      m.IsFlag1 != 1      AND m.IsFlag2 != 1  I have a
covering index, with the main columns being IsFlag1 and IsFlag2.
The execution plan shows and Index seek on this index, and then
a sort. The sort takes up 97% of the cost of the query according
to the execution plan.  I tried adding SomeId as a main column
of the index (the third column), but the execution plan remained
the same.  I then tried adding a covering index using only
SomeId as a main column, leaving the original index in place.
The execution plan then does an index scan on the new query, and
the ope