FIX: Reordering Joins May Cause MISSING JOIN PREDICATE Warning (322854)



The information in this article applies to:

  • Microsoft SQL Server 2000 (all editions)

This article was previously published under Q322854
BUG #: 357313 (SHILOH_BUGS)

SYMPTOMS

A query that contains a combination of inner and outer joins might result in a NO JOIN PREDICATE warning in the SHOWPLAN_ALL or STATISTICS PROFILE output or the corresponding "Missing Join Predicate" warning in SQL Profiler. The problem occurs when the optimizer reorders an OUTER JOIN above an inner join when there is no direct or inferred join condition between the two tables in the resultant inner join. This may cause the query to run slower than usual, with a corresponding increase in system resources to process the query.

CAUSE

Under most circumstances, it is more efficient to process an inner join before an outer join because the inner join is more likely to reduce the number of rows that require more processing. The optimizer starts off with an initial join ordering based on this criteria, and then considers various permutations until it finds a good execution plan. Under certain circumstances, this reordering might result in a cartesian product because of the lack of a join predicate.

RESOLUTION

To resolve this problem, obtain the latest service pack for Microsoft SQL Server 2000. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

290211 INF: How To Obtain the Latest SQL Server 2000 Service Pack

NOTE: The following hotfix was created before the release of Microsoft SQL Server 2000 Service Pack 3.

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

   8.00.0625     Sqlservr.exe
				
NOTE: Because of file dependencies, the most recent hotfix or feature that contains the files may also contain additional files.


WORKAROUND

To work around this behavior, use the OPTION (FORCE ORDER) query hint or the SET FORCEPLAN option to prevent the optimizer from generating the initial heuristic join order.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.
This problem was first corrected in Microsoft SQL Server 2000 Service Pack 3.

Modification Type:MinorLast Reviewed:9/27/2005
Keywords:kbHotfixServer kbQFE kbSQLServ2000sp3fix kbbug kbfix kbSQLServ2000preSP3fix KB322854