Microsoft KB Archive/251277

From BetaArchive Wiki
Knowledge Base

PRB: Poor Cardinality Estimation for Inequality Expressions in Joins

Article ID: 251277

Article Last Modified on 6/9/2000


  • Microsoft SQL Server 7.0 Standard Edition

This article was previously published under Q251277


If a query has a join predicate with some inequality expression, like <, <=, >, >=, LIKE, or BETWEEN, and the predicate is also one of the most selective predicates in the query, the query optimizer may fail to pick an optimal plan.


The optimizer is not designed to combine histograms for two different indexes for any situation other than an equality predicate. Instead, a "magic number" is used in estimating the cardinality. If this estimate is considerably different than the actual cardinality, the plan may not be optimal.


Use a join and/or index hint to achieve the result you want.

Additional query words: slow performance optimize bad poor plan

Keywords: kbprb KB251277