Re: Advanced SQL question: NOT EXISTS

From: Don Smith <eddas_at_huber.com>
Date: 1995/05/26
Message-ID: <3q4t39$mts_at_muddy.huber.com>#1/1


In article <3q2c1i$fep_at_News1.mcs.com>, stowe_at_mcs.net writes:

|>
|> EXISTS is not the same as NOT EXISTS. If you consider it for a moment, EXISTS allows the
|> query to stop running as soon as a match is found, but NOT EXISTS forces the entire table to be
|> checked in order to rule out a match.
|>
|> To summarize
|> EXISTS -> Good
|> NOT EXISTS -> Bad
 

Sorry, I can't buy into this argument. There's no reason why the NOT in NOT EXISTS should have any effect but to reverse the result of the subquery. In either case, the subquery should stop as soon as a match (ie, a row which satisfies the subquery criteria) is found. Yes, it usually takes longer to find out that something does not exist than to find out that it does. But it's the subquery, not the NOT, which will determine how frequently the row sought will not be found. Not?

-- 
-- 
============================================================
Donald A. Smith         Just another of the many Don Smiths
eddas_at_huber.com                  on the net               
Received on Fri May 26 1995 - 00:00:00 CEST

Original text of this message