Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL CODE - SELECT Statement
Message
From
26/08/2003 08:49:04
 
 
To
26/08/2003 08:10:30
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00823214
Message ID:
00823362
Views:
21
>>Hi cecil,
>>
>>Unlike using NOT IN() the NOT EXIST clause does not execute an extra query (but is internally processed like a join) and therefore should be faster in most cases.
>>
>>
>SELECT cFileName ;
>>	FROM tmpPDFFileNames a ;
>>	WHERE NOT EXIST(SELECT * FROM Scan b WHERE a.cFileName = b.cFileName) ;
>>	INTO CURSOR tmpPDFs
>>
>
>Actually, the NOT IN version of this query should be faster because the subquery only has to be executed once. In this version, the subquery has to be executed for each value of a.cFileName.

Tamar,

1) Why would the subquery in the above only have to run once if NOT IN... was used, considering that the subquery's WHERE argument is changed from record to record?

2) How can NOT IN be faster that NOT EXIST... when the former needs to get ALL possibly qualifying records and then compare them while the latter only has to get a single record to 'know' that the "NOT" is not satisfied?


>
>Tamar
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform