Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL CODE - SELECT Statement
Message
From
26/08/2003 10:44:36
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00823214
Message ID:
00823430
Views:
23
>Hi Jim,
>
>
>PMFJI,
>
>
>>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?

>
>Tamar referes to the original query which has to be run only once and result is cached by VFP.
	WHERE tmpPDFFileNames.cFileName NOT IN (SELECT cFileName FROM SCAN)	;
>
>>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?
>
>In most cases it is faster because VFP caches the result of the NOT IN subquery and don't need original data for NOT IN check. In case of correlated NOT EXISTS subquery, it has to be run for every row in the main query against original data in the table.

I should have gone back and looked at the original query. My bad.

cheers and thanks
Previous
Reply
Map
View

Click here to load this message in the networking platform