Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sub queries or separate SELECTs?
Message
De
23/09/2005 21:26:04
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
23/09/2005 19:07:09
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01052615
Message ID:
01052650
Vues:
8
In one case, I had a query involving 9 tables (one less than the maximum permitted in VFP 6, as I learned later), that took 50 seconds over the network. After separating it into queries that added only one table at a time, the time dropped to 2 seconds.

Since then, I changed most of the existing queries, and always split new queries into pieces.

This also aids in clarity.

However, results are known to vary in Visual FoxPro, so in the case of a very slow query, you may still want to experiment with different alternatives.

>Hi,
>
>Is there a speed advantage to using separate SELECT commands as opposed to humping them up into a single command using sub queries?
>
>Here's an example of what I'm refering to:
>
>SELECT Field1,CNT(*) as nTotal FROM ATable INTO CURSOR crsCursor1 GROUP BY Field1
>
>SELECT nTotal FROM crsCursor1 INTO CURSOR crsCursor2
>
>
>as opposed to
>
>
>SELECT nTotal FROM (SELECT Field1,CNT(*) as nTotal FROM ATable GROUP BY Field1) INTO CURSOR crsCursor2
>
>
>The first example is more of a pain to clean up after but is easier to debug. I'm just wondering if there is a runtime speed advantage to any of them.
>
>Aloha,
>
>James
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform