Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Speed of SEEK, SEEK(), LOCATE, and SQL SELECT
Message
 
 
To
29/06/1999 11:24:50
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00235086
Message ID:
00236590
Views:
21
Hi Peter,

Take out the "into array" clause of the SQL statement and compare again. No fair timing the creation of an array for the SQL-SELECT part of the test. <g>

Also, try the new INDEXSEEK(), which doesn't move the record pointer (as SEEK() does), Am curious to see how it does.

Susan

---------------------------------------
>Appended below:
>
>***********************************************************************
>* PROCEDURE TMSEEK.PRG
>***********************************************************************
>* Created.....: 1999.06.28
>* History.....:
>**********************************************************************
>
>lparameter tnLoops
>
>local lnLoops
>local lnSeconds
>local lnSeconds2
>local lnKey
>
>local array laName[1]
>
>close data all
>use SEEKTEST
>=rand(-1)
>
>if type("tnLoops")="N"
> lnLoops = tnLoops
>else
> lnLoops = 100
>endif
>
>?
>? str(lnLoops) + " random lookups -- avg time in MS"
>
>** This is just to load up indexex etc. and reduce the start-up effect.
>set order to iOWNERS
>for lnI = 1 to 1000
> lnKey = int(rand()*100000)
> seek lnKey
>endfor
>
>lnSeconds = seconds()
>for lnI = 1 to lnLoops
> seek int(rand()*100000)
>endfor
>lnSeconds2 = seconds()
>? " Using SEEK --" ;
> + str((lnSeconds2-lnSeconds)*1000/lnLoops,10,3)
>
>set order to
>lnSeconds = seconds()
>for lnI = 1 to lnLoops
> =seek(int(rand()*100000),"SEEKTEST","iOWNERS")
>endfor
>lnSeconds2 = seconds()
>? " Using SEEK() --" ;
> + str((lnSeconds2-lnSeconds)*1000/lnLoops,10,3)
>
>set order to iOWNERS
>lnSeconds = seconds()
>for lnI = 1 to lnLoops
> =seek(int(rand()*100000),"SEEKTEST","iOWNERS")
>endfor
>lnSeconds2 = seconds()
>? " Using SEEK() w ORDER --" ;
> + str((lnSeconds2-lnSeconds)*1000/lnLoops,10,3)
>
>set order to
>lnSeconds = seconds()
>for lnI = 1 to lnLoops
> locate for iOWNERS = int(rand()*100000)
>endfor
>lnSeconds2 = seconds()
>? " Using LOCATE --" ;
> + str((lnSeconds2-lnSeconds)*1000/lnLoops,10,3)
>
>if lnLoops <= 10000
> lnSeconds = seconds()
> for lnI = 1 to lnLoops
> lnKey = int(rand()*100000)
> select cName from SEEKTEST ;
> where SEEKTEST.iOWNERS = lnKey ;
> into array laName
> endfor
> lnSeconds2 = seconds()
> ? " Using SQL SELECT --" ;
> + str((lnSeconds2-lnSeconds)*1000/lnLoops,10,3)
>endif
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform