Microsoft KB Archive/331158

= FIX: A Query That Causes a Hash Bailout May Return Incorrect Results =

Article ID: 331158

Article Last Modified on 10/11/2005

-

APPLIES TO


 * Microsoft SQL Server 2000 Standard Edition

-



This article was previously published under Q331158





SYMPTOMS
Complex queries that involve hash joins on large data sets or data sets that involve skewed distributions may be converted to use a merge join at run-time (a &quot;hash bailout&quot;). If a hash bailout occurs in a SELECT query that uses a hash join, the query may return an incorrect number of rows.



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

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

http://support.microsoft.com/contactus/?ws=support

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 usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

This fix is not in SQL Server 2000 Service Pack 3. There are two different versions of the fix. The first version, build 693, is designed for SQL Server 2000 Service Pack 2. The second version, build 765, is for SQL Server 2000 Service Pack 3.

SQL Server 2000 Service Pack 3
This hotfix, build 765, is designed for a server that is running SQL Server 2000 Service Pack 3.

The English version of this fix has the file attributes (or later) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.

  Date         Time   Version         Size             File name -  08-Feb-2003  05:43                    786,432 bytes  Distmdl.ldf 08-Feb-2003 05:43                  2,359,296 bytes  Distmdl.mdf 30-Jan-2003 01:55                        180 bytes  Drop_repl_hotfix.sql 01-Feb-2003 00:32  2000.80.763.0   1,557,052 bytes  Dtsui.dll 30-Jan-2003 05:18                    746,470 bytes  Instdist.sql 30-Jan-2003 01:55                      1,402 bytes  Inst_repl_hotfix.sql 08-Feb-2003 06:40  2000.80.765.0      90,692 bytes  Msgprox.dll 08-Feb-2003 03:53                  1,065,895 bytes  Replmerg.sql 08-Feb-2003 06:40  2000.80.765.0     221,768 bytes  Replprov.dll 08-Feb-2003 06:40  2000.80.765.0     307,784 bytes  Replrec.dll 30-Jan-2003 05:18                  1,084,318 bytes  Replsys.sql 08-Feb-2003 06:40  2000.80.765.0     176,696 bytes  Sqlmap70.dll 08-Feb-2003 06:40  2000.80.765.0      57,920 bytes  Sqlrepss.dll 08-Feb-2003 06:41  2000.80.765.0   7,528,529 bytes  Sqlservr.exe 08-Feb-2003 06:40  2000.80.765.0      45,644 bytes  Sqlvdi.dll 08-Feb-2003 06:40  2000.80.765.0      82,492 bytes  Ssnetlib.dll

SQL Server 2000 Service Pack 2
This hotfix, build 693, is designed for a server that is running SQL Server 2000 Service Pack 2.

The English version of this fix has the file attributes (or later) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.

  Date         Time   Version        Size             File name -  16-Oct-2002  18:52  2000.80.693.0  7,471,185 bytes  Sqlservr.exe Note Because of file dependencies, the most recent hotfix or feature that contains the files may also contain additional files.

Note The following article discusses a more recent fix for a variation of this problem that is not addressed in the build discussed in this article. The hotfix discussed in article 824028 includes a fix for both the variation of the problem and for the issue discussed in this article. Therefore, if the symptoms described in this article apply to you, it is best to apply the fix in the article 824028 so that you can benefit from both fixes.

824028 FIX: An Outer or Semi JOIN Query That Results in Hash Role Reversal Followed by a Spill May Return Incorrect Results



WORKAROUND
To work around the problem, add an &quot;OPTION (LOOP JOIN, MERGE JOIN)&quot; query hint to the affected query.



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.



MORE INFORMATION
To validate the applicability of this hotfix to your scenario, check the following:


 * Use SQL Profiler and capture the EventClass Execution Plan. Check to see if the query that is resulting in incorrect results is using the HASH operator.
 * Use SQL Profiler and capture the EventClass Hash Warning and confirm that this event is raised. If so, make sure that the data column EventSubClass contains &quot;Hash Recursion.&quot; For more information, see the &quot;Errors and Warnings Event Classes&quot; topic in SQL Server Books Online.

Additional query words: hash match bail

Keywords: kbbug kbfix kbqfe kbhotfixserver KB331158

-

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

© Microsoft Corporation. All rights reserved.