Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What is better and faster
Message
From
19/01/2005 04:32:45
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
00977833
Message ID:
00978445
Views:
24
Hi Nadya,
>SET ANSI OFF
>select ... from ... where cl_name ="GREE" and cf_name = "MAR" and cM_Initial = ""
>or I can use
>lcName = padr("GREE",25,"_") + padr("MAR",20,"_")+padr("",1,"_")
>select ... from ... where cl_name + cf_name + cm_Initial LIKE lcName
First off: I believe if you set ansi off, the results should be different, so any comparison might be unfair just on the number of returned values for index expressions and the resulting data set - but I am a bit blurry at the moment from not enough sleep<g>.
select ... from ... where cl_name =="GREE" and cf_name == "MAR" and cM_Initial == ""
should be equal to
lcName = padr("GREE",25,"_") + padr("MAR",20,"_")+padr("",1,"_")
select ... from ... where cl_name + cf_name + cm_Initial == m.lcName
If your table is non-trivial, always include the MDot: it gets searched for every record.
For measuring "targeted" speed differences I'ld recommend putting the table and index onto another computer with a bottleneck connection: either use an old 10 MBit hub or serial connection to simulate a busy LAN - Probably then the second version will be faster if the table has many records. If speed is of utmost importance for this, also try out seek / scan while.

my 0.02 EUR

thomas
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform