FIX: Query Optimizer Fails to Consider Anti Semi Join for NOT IN Queries

Article translations Article translations
Article ID: 224539 - View products that this article applies to.
This article was previously published under Q224539
This article has been archived. It is offered "as is" and will no longer be updated.
BUG #: 53568 (SQLBUG_70)
Expand all | Collapse all

SYMPTOMS

For queries that contain a predicate ... IN (a, b, c, ...), the SQL Server 7.0 optimizer evaluates the possibility of converting the query to a semi join. However, it fails to consider a similar simplification that would simplify a ... NOT IN (a, b, c, ...) as an anti semi join. Thus, a NOT IN query returning a similar number of rows may take considerably longer to run than a corresponding query using IN.

WORKAROUND

To work around this problem, explicitly create and populate an intermediate table with this list of values from the NOT IN clause, and rewrite the query using a join.

STATUS

Microsoft has confirmed this to be a problem in SQL Server 7.0. This problem has been corrected in U.S. Service Pack 1 for Microsoft SQL Server 7.0. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
232570INF: How to Obtain Service Pack 1 for Microsoft SQL Server 7.0 and Microsoft Data Engine (MSDE) 1.0
For more information, contact your primary support provider.

Properties

Article ID: 224539 - Last Review: October 20, 2013 - Revision: 2.0
APPLIES TO
  • Microsoft SQL Server 7.0 Standard Edition
Keywords: 
kbnosurvey kbarchive kbbug kbfix kbqfe KB224539

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com