Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Improving sluggish SQL
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00306158
Message ID:
00520359
Views:
17
>select * from table1;
>where keyfield NOT IN;
>(select keyfield from table2)

>Any ideas for something faster?

I don't think I saw this option. Since the sub-query isn't optimizable, this might be faster if the records of table2 in table1 is a small percentage or the whole.

First pull the records from table2 that exist in table1. This should be fully optimized.
SELECT table2.keyfield;
    FROM Table2 JOIN Table1 
        ON table2.keyfield-table1.keyfield;
    INTO CURSOR temp

SELECT *
    FROM table1
    WHERE keyfield NOT IN;
        (SELECT keyfield from temp)
hth
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform