Microsoft KB Archive/292432

= FIX: OR of Multiple Expressions with Common Subexpressions May Choose Poor Plan =

Article ID: 292432

Article Last Modified on 10/7/2005

-

APPLIES TO


 * Microsoft SQL Server 2000 Standard Edition

-



This article was previously published under Q292432



BUG #: 352461 (SHILOH)



SYMPTOMS
For a query of the form SELECT ... FROM WHERE (P1 AND P2) OR (P1 AND P3) where Pn is some expression (that is, a predicate), the optimizer may fail to choose an optimal plan.



CAUSE
The SQL Server 2000 optimizer added a new feature to factor out common predicates, so that the expression shown in the &quot;Symptoms&quot; section is converted to the form: P1 AND (P2 OR P3) If there is a select index that you can use for expression P1, this factored format is easier to optimize. However, in the factored format, the optimizer fails to consider the choice of a union of two index lookups, which is an index seek on the predicate (P1 AND P2) unioned with another lookup on (P1 and P3).



RESOLUTION
A supported fix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Apply it only to computers that are experiencing this specific problem. This fix may receive additional testing. Therefore, if you are not severely affected by this problem, Microsoft recommends that you wait for the next SQL Server service pack that contains this hotfix.

To resolve this problem immediately, contact Microsoft Product Support Services to obtain the fix. For a complete list of Microsoft Product Support Services phone numbers and information about support costs, visit the following Microsoft Web site:

http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS

NOTE: In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The typical support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

The English version of this fix should have the following file attributes or later:   Version      File name

8.00.262    s80262i.exe NOTE: Due to file dependencies, the most recent hotfix or feature that contains the preceding files may also contain additional files.



STATUS
Microsoft has confirmed this to be a problem in SQL Server 2000.

Keywords: kbbug kbfix kbqfe kbsqlserv2000sp1fix KB292432

-

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

© Microsoft Corporation. All rights reserved.