Microsoft KB Archive/327562

From BetaArchive Wiki
Knowledge Base


FIX: Joins with a UNION ALL View May Take a Long Time to Compile and May Use Large Amounts of Memory

Article ID: 327562

Article Last Modified on 9/27/2005



APPLIES TO

  • Microsoft SQL Server 2000 Standard Edition



This article was previously published under Q327562

BUG #: 361283 (SHILOH_BUGS)

SYMPTOMS

Queries that join several tables and a view that contains a UNION ALL statement may take a long time to optimize and may cause the optimizer to use a lot of memory. Under certain conditions, the query might use as much as 80 percent of the memory allocated by SQL Server. If that is the case, the query, or other queries, might fail and you receive the following error message:

Msg 701, Level 17, State 99, Line 1
There is insufficient system memory to run this query.

During the compilation of the query (even after the 701 error occurs), other user connections might experience slow performance and it may appear that SQL Server has stopped responding.

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

   8/6/2002   13:09   8.00.0674   7293 KB   Sqlservr.exe

                

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



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.

MORE INFORMATION

The fix compares union-all operators based on a set of columns. The exploration phase ends as soon as SQL Server recognizes that the set of columns are logically the same (only their order is different).

You can characterize the memory usage behavior by using Performance Monitor. Note that the object: [Memory Manager -> Optimizer Memory] exhibits continuous growth while the query is being run.


Additional query words: 701 hang memory view union all join performance compile time

Keywords: kbbug kbfix kbsqlserv2000presp3fix kbqfe kbsqlserv2000sp3fix kbhotfixserver KB327562