Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Very Slow SQL , Why?
Message
De
10/08/1998 15:31:06
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
09/08/1998 07:32:18
Rick Clarke
Fotobae Pty. Ltd.
Adelaide, Australie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00122940
Message ID:
00125402
Vues:
18
>Hi again
>I have found that using SELECT * from anytable where cond1=cond2 etc.. very fast.
>It is when my select has 57 fields from 3 tables and a search criteria varaible that looks like this...
>&SQLString="BETWEEN(num1,num2) AND INLIST(Filed,A,B,C,D) AND ALLTRIM(UPPER(STATE) = ALLTRIM(UPPER(STATE)) AND AND AND etc.." upto perhaps 20 criteria.
>
>SELECT Field1,Field2 - Field57;
>+WHERE t1.Key=t1.Key etc. etc.;
>+&SQLString;
>+etc... etc... INTO CURSOR MYCURSE. **(Pun Intended)**
>

If you're selecting from more tables, do a one-table select on the biggest one first, to narrow things down, then use the resulting cursor instead of the big table in the join select. This may speed things up.

Depending on the size of your table and the resulting recordset, you may get better results even on a single-table query if you use a simple filter on it first, then select with other criteria from it. Your mileage may vary, though.

Two more tips: use "a between b and c" instead of "between(a,b,c)" - the former is SQL, the later is Fox. The same goes for " a IN (b,c,...)" instead of "inlist(a,b,c,...)".

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform