Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
UDF's second rate citizen in Rushmore ?
Message
From
06/09/2006 11:00:17
Mike Yearwood
Toronto, Ontario, Canada
 
 
To
06/09/2006 04:51:40
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01151219
Message ID:
01151346
Views:
38
>When I join on index expressions based on pure dbf-table fields or index expressions using only vfp functions on dbf/fpt fields (padded to stable length in case of fpt-fields) sys(3054) shows the already created index is used directly in the join. If index expressions involving UDF's are used, a temporary index is calculated, even if the UDF is certain to be of fixed length: either returning a PADR() or wrapping the udf in the index expression like PADR(myUdf(field1), 20).
>
>I do think that functions in a .fll don't show that annoying behaviour, but haven't verified - perhaps I am mixing it up with the level Type() can check, as type() will return the type of a fll-function but not of a vfp-udf.
>
>What I would like to do is something similar to
>set proc to myPrc additive && includes myUdf1 and myUdf2
>select newData
>index on Padr(myUdf1(Field1), 20) + Padr(myUdf2(Field2), 15) tag F_1_2_new
>
>select oldData
>index on Padr(myUdf1(Field1), 20) + Padr(myUdf2(Field2), 15) tag F_1_2_Old
>
>Select ;
>    Nw.Field3, Ol.Field4 ;
>    from newData Nw ;
>    join oldData Ol ;
>        on  Padr(myUdf1(ol.Field1), 20) + Padr(myUdf2(ol.Field2), 15) ;
>          = Padr(myUdf1(ne.Field1), 20) + Padr(myUdf2(ne.Field2), 15)
>
I have another possible option for you. Convert your UDF to a Snippet. That way you can reuse it in many places, like a UDF and you can maintain it in one place. The performance is much better than the UDF too. Index commands will run faster.

How does VFP update the index when a UDF is involved? Wouldn't that require the UDF to fire? If so, updating records will be faster using the snippet too.

http://msvfp.advisorguide.com/doc/17440
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform