Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to use select... where EXISTS ... ?
Message
 
 
To
27/05/2003 12:10:38
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00793069
Message ID:
00793156
Views:
34
>Sergey,
>Didn't do the tests. You might be right. Just thinking on SQL specification most of the time EXISTS sounds to be faster to me. Both subqueries might be called N times, however say subquery for IN is returning 1000 rows and the value compared is about the ends. Each time nearly 1000 rows should be checked. OTOH for EXISTS it's either a .T./.F. return. Subquery might still return 1000 rows but 1 or 1000 means .T. and returns immediately.
>Just my 0.02 cents.

Hi Cetin,

In reality, IN subquery runs only once and VFP can build index on it and use equivalent of SEEK() function to find if record is in that result set. The EXISTS subquery has to be run agains the real table for each record in the main query.
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform