Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Macro substitution slow
Message
De
23/06/2000 19:04:37
 
 
À
23/06/2000 17:14:51
Bob Smith
Custom Data Services, Inc.
Mansfield, Massachusetts, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00383777
Message ID:
00384131
Vues:
47
>Hi Jay,
>
>Your curiosity is good !
>
>The base table has 20,000 records but is expanding rapidly which worries me
>because it appears to be getting slower.
>It takes up to 5 secs per run.
>The result set might have 0-50 results (but usually about 5)
>The macro expansion is not within a loop. Its run once at a time.
>I am runing this on a network.
>I am placing the results in a grid.

A couple of points on this:

1) Macro substitution should not slow you down all that much is SQL select statement. SQl was orginally designed to parse strings into queries.


A couple of tricks.

1) Jay van Santen has told you, try executing the queries directly. You find the probelm lies in your query rather than in the Macro substitution.
2) Another trick. I have often fount that in a lot of case sql will run faster where the whole statement is in a string instead of part


For example:

Slow:
tname="source"

SELECT * FROM &tname into cursor temp.
FAST
lc_cmd="SELECT * FROM source into cursor temp"
&lc_cmd
last trick. This is an undocument quirk and may stop working in future version of VFP. You probably know that you can create a parameterized view by as follows:
CREATE SQL VIEW GEORGE AS SELECT * FROM SOURCE WHERE SOURCE.LASTNAME=?vp_lname
any time you want to look at a particular last name you can do the following:
vp_lname="Smith"
USE GEORGE
And of course the view george will contain only people with a last name of SMITH. Now to the undocumented part.

You can set up pamameters in normal on the fly select statements.

example:
vp_lname="Smith"
lc_cmd="SELECT * FROM SOURCE last_name=?vp_lname into cursor temp"
&lc_cmd
In a simple select like the one above this may make 0 difference. But in more complex select, I find that it sometimes results in better optimization.
Thanks

Gar W. Lipow
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform