Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Best way to find orphans - seek vs SQL
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00444141
Message ID:
00444192
Vues:
10
Nadya,

No guarantees on whether or not it's faster, it probably depends on the number of orphans:
select table1.propid, table2.propid as table2key ;
   from table1 ;
   left outer join table2 ;
      on table1.propid = table2.propid ;
   into cursor orphans ;
   having isnull( table2key )
>Hi everybody,
>
>I have Table1 (child) with ~5mln.records and Table2(parent) with ~4mln.records
>
>I want to find and cound each record in Table1 key PropID, what doesn't have
>corresponding record in Table2.
>
>Two ways of doing that:
>scan Table1
>seek PropID && in Table2
>if not found()
>   *** This is an orphan.
>endif
>endscan
>
>or
>
>select PropID from Table1 where PropID not in (select PropID from Table2).
>
>Both tables, of course, have indexes on PropID.
>
>My question is: what is the fastest way of doing this?
>Currently we're using method 1 and I have not patience enough to perform test2.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform