Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Strange SQL Speed
Message
De
19/10/2000 08:07:19
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00431066
Message ID:
00431377
Vues:
13
>>SELECT fieldx FROM table2 WHERE fieldx NOT IN (SELECT fieldx FROM table1)
>
>Try following query:
>
>SELECT fieldx FROM table2 WHERE NOT EXISTS (SELECT fieldx FROM table1 where table1.fieldx=table2.fieldx)
>

Your version requires the subquery to be run multiple times (once for each value of fieldx in table2). Dore's original version on needs to run the subquery once.

In general, it's always a good idea to turn an EXISTS subquery into an IN subquery. You want to avoid referencing any table from the main query in the subquery - such a query is called "correlated" and is generally slower than a query that isn't correlated.

Tamar
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform