FIX: Optimizer Slow to Generate Query Plan for Complex Queries that have Many Joins and Semi-Joins (274329)
The information in this article applies to:
- Microsoft SQL Server 2000 (all editions)
This article was previously published under Q274329
BUG #: 236107 (SHILOH_bugs)
SYMPTOMS
When compiling complex queries that involve many views, which have more than 20 tables, joins, GROUP BY clauses, sub-queries and outer-joins, the optimizer takes a long time to produce a query plan. SQL Server still processes other queries and CPU use is high during this time.
CAUSE
The SQL Server query optimizer is a cost based optimizer and the optimizer is trying to build an optimal query plan. During optimization, the large number of joins, views, GROUP BY clauses, sub-queries and outer-joins are broken down into simpler operations, including semi-joins. Semi-joins interact with the join reordering logic and cause an increase in the combinations considered in higher levels of the operator tree. The server considers a large number of join permutations that are changed by the semi-joins below it, which results in reordering at the higher levels. In effect, the time to generate the optimal plan is much higher and it may appear that the query has stopped responding (hang).
RESOLUTIONTo 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
HotfixNOTE: The following hotfix was created prior to Microsoft SQL Server 2000 Service Pack 1.
The English version of this fix should have the following file attributes or later:
File name Platform
--------------------------
s80204I.exe Intel X86
NOTE: Due to file dependencies, the most recent hotfix or feature that contains the preceding files may also contain additional files.
STATUSMicrosoft has confirmed that this is a problem in Microsoft SQL Server 2000. This problem was first corrected in SQL Server 2000 Service Pack 1.
Modification Type: | Major | Last Reviewed: | 10/9/2003 |
---|
Keywords: | kbBug kbfix kbQFE kbSQLServ2000sp1fix KB274329 |
---|
|