Microsoft KB Archive/234883

= FIX: Wrong Index Chosen When Query References Values Beyond Statistics =

Article ID: 234883

Article Last Modified on 3/14/2006

-

APPLIES TO


 * Microsoft SQL Server 7.0 Standard Edition

-



This article was previously published under Q234883



BUG #: 55366 (SQLBUG_70)



SYMPTOMS
The optimizer may select the wrong plan for processing a query if the values in a search argument are not contained within the range of statistics for an expected index. This can cause significantly slower performance in queries.

This situation is usually encountered when nonclustered index growth is extending the index in a particular direction, in contrast to being randomly distributed throughout the values for the index. For a query that wants to use the nonclustered index in the outlying range, the clustered index may be improperly selected over the nonclustered index since the latter inserted values are not contained in the statistics for the nonclustered index (that is, the optimizer has no information that the outlying values exist).



WORKAROUND
Here are two workarounds:


 * Run UPDATE STATISTICS and execute sp_recompile on the affected table to alleviate the problem.
 * Consider making the extending index the clustered index.



STATUS
Microsoft has confirmed this to be a problem in SQL Server 7.0. This problem has been corrected in U.S. Service Pack 2 for Microsoft SQL Server 7.0. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

254561 INF: How to Obtain Service Pack 2 for Microsoft SQL Server 7.0 and Microsoft Data Engine (MSDE) 1.0

For more information, contact your primary support provider.

Keywords: kbbug kbfix KB234883

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.