Article ID: 299950 - View products that this article applies to.
This article was previously published under Q299950
This article has been archived. It is offered "as is" and will no longer be updated.
BUG #: 101678 (SQLBUG_70)
A slower than optimum join strategy is chosen for the join of two tables.
The STATISTICS PROFILE output for the problem query indicates that the estimated number of rows (as indicated by the EstimateRows column) to be output by a given join operation is significantly lower than the actual number of rows output by the join (as indicated by the Rows column).
In some instances, the maximum value for a given column is not represented in the histogram steps of the statistical information stored for a given column.
In certain cases (like an equi-join of two columns), the ranges of values stored in the statistical histogram are compared in an attempt to estimate the number of rows that are to be output by a given join operation. In the special case where the maximum value is also a frequent value in the table being joined to, the optimizer under costs the join.
To resolve this problem, obtain the latest service pack for Microsoft SQL Server 7.0. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
301511NOTE: The following hotfix was created prior to Microsoft SQL Server 7.0 Service Pack 4.
(http://support.microsoft.com/kb/301511/EN-US/ )INF: How to Obtain the Latest SQL Server 7.0 Service Pack
The English version of this fix should have the following file attributes or later:
NOTE: Because of file dependencies, the most recent hotfix or feature that contains the preceding files may also contain additional files.
File name Platform ---------------------- s70996i.exe Intel s70996a.exe Alpha
Use a join hint to force a more efficient join strategy.
Please exercise caution when you force a join strategy for two tables through a join hint. If a join hint is specified for any two tables, the query optimizer automatically enforces the join order for all joined tables in the query, based on the position of the ON keywords.
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 7.0 Service Pack 4.
After you apply this fix, you must update the statistics for the table that was affected by this problem. This step is necessary to realize the benefit of this fix.
For more information regarding how to update the statistics for a given table, refer to the "UPDATE STATISTICS (T-SQL)" topic in SQL Server 7.0 Books Online.
Note that if AUTO UPDATE STATISTICS is enabled for the database, the problem should be corrected automatically the next time the statistics are updated for the problem table.
Contact us for more help