Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do I optimize a SQL Select statement
Message
 
À
30/05/2003 11:40:05
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00794536
Message ID:
00794544
Vues:
11
One of the alternatives is NOT to use SQL select.
Let us suppose you have index on fld2search in "related table".
Then you may try someting like:
use "related_table" in 0 order fld2search
sele table2scan
scan
if indexseek(table2scan.keyfield,.t.,"related_table", "fld2search")
sele related_table
skip 1
if fld2search=table2scan.keyfield
* duplicate
endif
.....
endscan

Other approach could be like this:
select fld2search from related_table group by 1 having cnt(*)>1 into curs temp
index on fld2search tag fld2search
sele table2scan
set rela to keyfield into temp
scan for not eof("temp") &&duplicates only
*duplicate
endscan



>I have a SCAN loop with a nested SQL Select statement (to check for duplicates in related table on common field).
>
>The application can take up to 6 seconds to execute SQL Select against table with 223,000 records, which seems very slow to me. In VFP 8.0 doc it says that SQL statements attempt to optimize, and do so if possible, but don't use Rushmore optimization. Is this true? If so, what do I do to speed up this operation?
>
>Fz - Boston MA
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform