FIX: Slow Compile Time on Complex Joins with Unfiltered Table

Article translations Article translations
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)
Expand all | Collapse all

Symptoms

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.

Cause

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.

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     Platform
   -----------------------------------

   7.00.770     s70770i.exe   x86
   7.00.770     s70770a.exe   Alpha
				
NOTE: Due to file dependencies, the most recent hotfix or feature that contains the above files may also contain additional files.

Workaround

Add an additional filter condition that is always true. This avoids favoring the unfiltered table but does not affect the results.

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.

More information

The following query is an example of a query that has no filter condition on titleauthor other than the join predicate:
select a.au_id, a.au_lname, ta.title_id from authors a 
   join titleauthor ta on a.au_id = ta.au_id
where
   a.au_lname like 'S%'
				
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.

Properties

Article ID: 252905 - Last Review: November 2, 2013 - Revision: 3.0
Applies to
  • Microsoft SQL Server 7.0 Standard Edition
Keywords: 
kbnosurvey kbarchive kbbug kbfix KB252905

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com