Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SET RELATION question
Message
From
19/11/1998 12:04:54
 
 
To
19/11/1998 10:34:40
Walter Meester
HoogkarspelNetherlands
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00158705
Message ID:
00159346
Views:
21
>Edward,
>
>>If I will tell you what I really think about SET RELATION, I wonder that you take it as personal offense, so I would just stay within well-known fact that SET RELATION just mask on SEEK() behind the scene, so it cannot be faster.
>

Try this code fragment and you be able to verify that SET RELATION
is indeed faster. When opening the data each time the results on
my P-400 running NT 4.0 were as follows:

SET RELATION - .094 (faster)
SEEK - .110

without opening the data tables

SET RELATION - .062 (about twice as fast!)
SEEK - .125

notice that i ran the set relation first to give the seek
routine an advantage of priming the index tags...

The proof is in the benchmark.

*!* clos data all
*!* clea all
*!* clear

*!* open database tastrade
*!* use orders in 0 order order_id shared
*!* sele 0
*!* use order_line_items

lncnt = 0
lnst = seco()
set rela to order_id into orders
SCAN
IF NOT EOF('orders')
lncnt = lncnt + 1
ENDIF
ENDSCAN

@ 1,1 say 'SET RELATION Results:'
@ 2,1 say lncnt
@ 3,1 say seco() - lnst


lncnt = 0
lnst = seco()
scan
if seek(order_id,'orders')
lncnt = lncnt + 1
endif
endscan
@ 6,1 SAY 'SEEK results:'
@ 7,1 say lncnt
@ 8,1 say seco() - lnst
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform