Article ID: 274706
Article Last Modified on 3/14/2006
APPLIES TO
- Microsoft SQL Server 7.0 Service Pack 1
- Microsoft SQL Server 7.0 Service Pack 2
This article was previously published under Q274706
BUG #: 57921 (SQLBUG_70)
SYMPTOMS
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).
CAUSE
WORKAROUND
Reduce the number of UNIONs. If possible, avoid having more than about 40 UNIONs in a single SQL statement.
STATUS
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:
274799 INF: How to Obtain Service Pack 3 for Microsoft SQL Server 7.0 and Microsoft Data Engine (MSDE) 1.0
For more information, contact your primary support provider.
MORE INFORMATION
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".
No. of Unions | 20 | 40 | 80 | 160 | 320 |
Build 623 (ms) | 63 | 203 | 625 | 2156 | 7938 |
Build 699 (ms) | 79 | 360 | 1906 | 12578 | 96156 |
Additional query words: slow aggregate view regression runtime query
Keywords: kbbug kbfix KB274706