Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Group by clause in vfp8
Message
 
À
23/04/2003 03:31:38
Walter Meester
HoogkarspelPays-Bas
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00774269
Message ID:
00780942
Vues:
45
>George,
>
>>>>The statement is interpreted once and called multiple times in a FOR...NEXT iteration structure. There's no question about it.
>>>
>>>Not true, it's compiled once, interpretated and executed for each loop. That's the nature of P-code compile languages
>>>
>>Walter,
>
>>Yeah right! Before building applications, I wanted to do systems. I did quite a bit of studying, both formally and informally. What you're saying is this: The MAX() function executes once, scanning the entire table and returns the maximum value. Even if that were true, you don't eliminate the number of comparisons required.
>
>No, I did not say this. Read carefully. The statement in a FOR NEXT loop is interpreated and executed multiple times, while the MAX() function is interpretated onces (as a part of the SQL SELECT statement) and executed internally for each row. On what level it is executed I do not know because it is not documented.
>
>Now of course I do not know the internals of VFP, but the interpreation process at the least reads the P-code instruction again, sets a few variables (like the last linenumber), checks various settings (e.g. for the coverage profiler, the keyboard buffer, maybe other windows messages) etc. The SQL statement is a statement that is interpretated as a whole where certain parts which contains functions and other non optimizable expressions are evaluated when neccesarry. Also do remember that MAX(), MIN(), CNT() used in a SQL Statement are not normal VFP instructions as they only operate this way in the SQL statement. Their function might be totally different from normal VFP commands.
>
>>Further, any language developer will tell you that the difference between constants and variables is of no import. There's no difference between calling a function with a constant and calling the same function with a variable. Each iteration requires that the parameters be placed on the stack and passed to the function.
>
>I don´t deny this.
>
Walter,

I was going to ignore this post and let the whole thing die. However, better (or worse) judgment compels me to respond. Here's the question:

How do you think that the interpreter manages this? You have a function, you have numerous records which may have values greater or less than what the function was designed to return. The answer is the values must be individually compared. This is why there is addtional overhead when using any aggregate function.

Now if you think this is incorrect, just look at an SQL Server execution plan. It will show that a table scan (without an index) must be performed.

Since, however, you claim to know about p-code, let me ask you this question: Why can VFP 6.0, 7.0 and 8.0 run under any of the runtime (6.0, 7.0 and 8.0) libraries without modification provided no properties or methods don't have the same name as a new property or method?
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform