Article ID: 252905 - View products that this article applies to.
This article was previously published under Q252905
This article has been archived. It is offered "as is" and will no longer be updated.
BUG #: 56821 (SQLBUG_70)
A complex join query may take an excessive amount of time to compile a plan if one of the tables does not have any filter conditions other than the join predicate.
During optimization of the join order, certain heuristics are used to guess at a good plan to use as a starting point in analyzing the various join permutations. One of these heuristics favors a filtered table over an unfiltered table. If this assumption is wrong, it may take the optimizer a longer period of time to analyze all of the join permutations and to search out the best plan.
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;CNTACTMSNOTE: 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:
NOTE: Due to file dependencies, the most recent hotfix or feature that contains the above files may also contain additional files.
Version File name Platform ----------------------------------- 7.00.770 s70770i.exe x86 7.00.770 s70770a.exe Alpha
Add an additional filter condition that is always true. This avoids favoring the unfiltered table but does not affect the results.
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:
254561For more information, contact your primary support provider.
(http://support.microsoft.com/kb/254561/ )INF: How to Obtain Service Pack 2 for Microsoft SQL Server 7.0 and Microsoft Data Engine (MSDE) 1.0
The following query is an example of a query that has no filter condition on titleauthor other than the join predicate:
Note that this query is simple enough so that you do not see any performance impact as a result of the heuristic; this is usually only noticeable in queries with a large number of joins.
Contact us for more help