Article ID: 274706 - View products that this article applies to.
This article was previously published under Q274706
This article has been archived. It is offered "as is" and will no longer be updated.
BUG #: 57921 (SQLBUG_70)
Beginning with SQL Server 7.0 Service Pack 1 (build 699 and higher), the compilation of a SQL statement containing many UNIONs takes substantially longer than on the golden version (build 623).
Reduce the number of UNIONs. If possible, avoid having more than about 40 UNIONs in a single SQL statement.
Microsoft has confirmed this to be a problem in SQL Server 7.0. This problem has been corrected in U.S. Service Pack 3 for Microsoft SQL Server 7.0. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
274799For more information, contact your primary support provider.
(http://support.microsoft.com/kb/274799/ )INF: How to Obtain Service Pack 3 for Microsoft SQL Server 7.0 and Microsoft Data Engine (MSDE) 1.0
In every version of SQL Server of course, the compilation time is proportional to the number of UNIONs in a query. However, in SQL Server 7.0 Service Pack 1 and Service Pack 2, the impact of a large number of UNIONs is dramatic. The chart below compares the time for parse and compile time (CPU) between build 623 and 699. Each subset of the UNION queries was "select * from authors".
Collapse this tableExpand this table