Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Which statement is 'Better'
Message
 
 
À
09/09/2005 17:47:59
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 6
Divers
Thread ID:
01048319
Message ID:
01048414
Vues:
22
Rich,

You might also consider moving your loc.state='OR' up into the JOIN.

In SQL server you should avoid SELECT * in a query when none of the fields are actually used or you don't need all of them, you force a read of the data page even if can determine the result only from reading index pages. I/O is slow. Use SELECT 'X' instead.

>For example
>SELECT DISTINCT pol.agentcode,pol.ctrl_num,pol.incep_date FROM frpolicy pol;
>  JOIN frlocat loc ON pol.agentcode=loc.agentcode and pol.ctrl_num=loc.ctrl_num;
>  WHERE pol.incep_date >={8/31/2005} AND loc.state='OR'
>
>
>SELECT pol.agentcode,pol.ctrl_num,pol.incep_date FROM frpolicy pol;
> WHERE EXISTS (SELECT * FROM frlocat loc;
>                WHERE loc.agentcode=pol.agentcode
>                  AND loc.ctrl_num=pol.ctrl_num;
>                  AND loc.state="OR")
>   AND pol.incep_date >= {8/1/2005}
>
>
>produce identical results in approximately the same time.
>
>Is it a matter of style or is there a reason to use one rather than the other?
>
>Thanks......
df (was a 10 time MVP)

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

Click here to load this message in the networking platform