Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Optimizing SQL Select statement
Message
De
15/01/2013 11:48:59
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Divers
Thread ID:
01562602
Message ID:
01562661
Vues:
44
J'aime (1)
>FWIW - when doing complex queries against VFP data I find it MUCH faster to prequery the main tables on simple rushmore optimizable expressions and then use those cursors in my "real" query
>
>select fieldnames from maintable1 where somenum=x into cursor c_maintable1 readwrite nofilter
>
>select fieldnames from maintable2 where somenum=x into cursor c_maintable2 readwrite nofilter
>
>
>select c_maintable1.fieldnames,c_maintable2.fieldnames
>from c_maintable1 inner/left join on c_maintable2 on somecriteria blah blah blah
>
>
>Using this technique I have sped up queries by a factor of 10 or more.

Specially when the maintable1 was big and there were more joins, the factor was about 20... which made all the difference between "slow like molasses" and "immediately"... 12 years ago on a 200MHz machine. Still works nowadays, even on SQL. Sometimes I just get the selection from the big table, and relevant records from another, then join those cursors in Fox, or if I don't really need to show the joined fields, just check them for some records (in a batch process), I scan the first cursor while seek()ing the second. The repeated values aren't traveling across the wire, and I actually don't need them in all records of the first table.

This kind of scenario works every once in a while, and I'm glad it can be done this way - while developing and testing the thing, I have to run it dozens of times a day, so speed gains are important - it's MY time we're talking about :).

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
Répondre
Fil
Voir

Click here to load this message in the networking platform