FIX: SP1 Regression: A SELECT COUNT(*) From a View That Contains a UNION ALL May Be Significantly Slower or Fail (313313)



The information in this article applies to:

  • Microsoft SQL Server 2000 (all editions) SP1
  • Microsoft SQL Server 2000 (all editions) SP2

This article was previously published under Q313313
BUG #: 356082 (SHILOH_BUGS)

SYMPTOMS

A query like a "SELECT COUNT(*)" from a view that contains a UNION ALL statement from other views, tables or derived tables, may either be a hundred times slower than it was without any service packs installed, or it may not complete after it fills up the tempdb database. For more information, see the "UNION" and "derived tables" topics in SQL Server Books Online.

Note that this problem is data specific; therefore, the problem may not occur with all similar queries. Applying the fix that is described in this article only helps if you are experiencing the exact same scenario.

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:
   Date       Time   Version         Size        File name
   -----------------------------------------------------------

   11/20/01   5:29   2000.80.469.0    7,237 KB   Sqlservr.exe
   11/20/01   5:29                   12,257 KB   Sqlservr.pdb
				
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

This hotfix also fixes similar problems with operators of GROUP BY and DISTINCT.

REFERENCES

SQL Server Books Online: topics: "GROUP BY"; "DISTINCT"

Modification Type:MinorLast Reviewed:9/26/2005
Keywords:kbHotfixServer kbQFE kbbug kbfix kbSQLServ2000preSP3fix kbSQLServ2000sp3fix KB313313