Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Improving sluggish SQL
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00306158
Message ID:
00520359
Vues:
18
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform