Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Rushmore
Message
From
26/04/2005 06:19:40
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01008357
Message ID:
01008373
Views:
18
>Thank you Fabio,
>Is there a way to make this query optimizable?

On your context, it is full optimized, with the VFP engine capability.
Of course, if you known that
(SELECT Egn FROM Sl_Bel WHERE Sl_Bel.God == 2005)
return a big list, then you have to change the plan.

way 1 ( "NOT IN" is invariant with "LEFT JOIN + WHERE joinkey IS NULL" )
* try, but i'm not sure that force is used, AND THEN IT CAN TO BE SLOWER
SELECT Rab.Egn,;
       Rab.Ime AS Ime,;
       2005        AS God;
       FROM FORCE Sl_Bel ;
         RIGHT JOIN Rab ON Sl_Bel.God == 2005 AND Sl_Bel.Egn=Rab.Egn;
       WHERE Sl_Bel.Egn IN NULL;
INTO CURSOR GodBel READWRITE NOFILTER
WAY 2 ( vfp9 )
SELECT Rab.Egn,;
       Rab.Ime AS Ime,;
       2005        AS God;
       FROM FORCE (SELECT DISTINCT Egn FROM Sl_Bel WHERE Sl_Bel.God == 2005) Sl_Bel1 ;
        RIGHT JOIN Rab ON Sl_Bel1.Egn=Rab.Egn;
        WHERE Sl_Bel1.Egn IN NULL;
INTO CURSOR GodBel READWRITE NOFILTER
however, the result depends on the COUNT(Sl_Bel1)/COUNT(rab) value,
and the query with IN (SELECT...) could be faster.
Previous
Reply
Map
View

Click here to load this message in the networking platform