General information
Category:
Coding, syntax & commands
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only