Quantcast
Viewing all articles
Browse latest Browse all 15889

Seek predicate not using all columns

Hi,

I have a strange query compilation issue which is hard to reproduce. It only happens under high load and cannot be easily repeated.

  • There is a table T with columns A,B,C,D.
  • There is a non-unique clustered index on T(A, B, C, D).
  • There is a query SELECT * FROM T WHERE A=@P1 AND B=@P2 AND (C=@P3 OR C=@P4) AND D=@P5. The seek condition is on all columns of the clustered index, the 3-rd column has an OR.

The problem is that the query plan for this query has Seek Predicate only on A and B! The predicate on C and D is an ordinary predicate, so this means that search tree on columns C and D is not utilized.

Could anyone provide any hints on why this could be happening? SQL version is 2008 R2 (SP1) - 10.50.2789.0 (X64) 





Viewing all articles
Browse latest Browse all 15889

Trending Articles