FIX: Wrong Index Chosen When Query References Values Beyond Statistics

This article was previously published under Q234883
This article has been archived. It is offered "as is" and will no longer be updated.
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.
Properties

Article ID: 234883 - Last Review: 10/21/2013 22:33:46 - Revision: 2.1

  • Microsoft SQL Server 7.0 Standard Edition
  • kbnosurvey kbarchive kbbug kbfix KB234883
Feedback