FIX: Query Plan Inconsistent If Search Value > Last Step

Last reviewed: April 30, 1997
Article ID: Q134822

The information in this article applies to:
  • Microsoft SQL Server, version 6.0
BUG# NT: 10264 (6.00)

SYMPTOMS

The Microsoft SQL Server version 6.0 query optimizer may sometimes choose to use an index and sometimes choose to do a table scan for the same query on the same data with the same distribution statistics.

CAUSE

The query optimizer incorrectly calculates the cost of using an index when the query WHERE clause contains a search value that is greater than the largest distribution step for a given index, but less than the largest value in the table for the indexed column.

Even if the above conditions are met, the problem is still unlikely to occur with most queries. If you suspect this problem is occurring on a slow-running query, you should take other troubleshooting steps first, including running the UPDATE STATISTICS statement, examining the query's showplan output, and examining the table/index design as described in Knowledge Base article Q110352 - "INF: Optimizing SQL Server Performance."

WORKAROUND

Use optimizer hints to force a given query plan.

STATUS

Microsoft has confirmed this to be a problem in Microsoft SQL Server version 6.0. This problem was corrected in Service Pack 1 for SQL Server version 6.0. For more information, contact your primary support provider.


Additional query words: sql6 optimization performance
Keywords : kbbug6.00 kbenv kbfix6.00.sp1 SSrvProg SSrvTran_SQL
Version : 6.0
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: April 30, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.